Title: [117933] trunk/Source/WebCore
Revision
117933
Author
[email protected]
Date
2012-05-22 01:38:34 -0700 (Tue, 22 May 2012)

Log Message

[V8] Add an optional 'isolate' argument to throwTypeError()
https://bugs.webkit.org/show_bug.cgi?id=87070

Reviewed by Adam Barth.

The objective is to pass Isolate around in V8 bindings.
This patch adds an optional 'isolate' argument to throwTypeError(),
and passes Isolate to throwTypeError()s. In a following patch,
I'll pass Isolate to all throwTypeError("message")s.

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateNormalAttrSetter):
(GenerateOverloadedFunctionCallback):
(GenerateParametersCheck):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::overloadedMethodCallback):
(WebCore::TestObjV8Internal::overloadedMethod1Callback):
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::throwTypeError):
* bindings/v8/V8Proxy.h:
(V8Proxy):
* bindings/v8/custom/V8ArrayBufferViewCustom.h:
(WebCore::constructWebGLArray):
* bindings/v8/custom/V8DataViewCustom.cpp:
(WebCore::V8DataView::constructorCallback):
* bindings/v8/custom/V8SVGLengthCustom.cpp:
(WebCore::V8SVGLength::valueAccessorSetter):
* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
(WebCore::vertexAttribAndUniformHelperf):
(WebCore::uniformHelperi):
(WebCore::uniformMatrixHelper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117932 => 117933)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 08:38:34 UTC (rev 117933)
@@ -1,3 +1,43 @@
+2012-05-22  Kentaro Hara  <[email protected]>
+
+        [V8] Add an optional 'isolate' argument to throwTypeError()
+        https://bugs.webkit.org/show_bug.cgi?id=87070
+
+        Reviewed by Adam Barth.
+
+        The objective is to pass Isolate around in V8 bindings.
+        This patch adds an optional 'isolate' argument to throwTypeError(),
+        and passes Isolate to throwTypeError()s. In a following patch,
+        I'll pass Isolate to all throwTypeError("message")s.
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateNormalAttrSetter):
+        (GenerateOverloadedFunctionCallback):
+        (GenerateParametersCheck):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjV8Internal::overloadedMethodCallback):
+        (WebCore::TestObjV8Internal::overloadedMethod1Callback):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::throwTypeError):
+        * bindings/v8/V8Proxy.h:
+        (V8Proxy):
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArray):
+        * bindings/v8/custom/V8DataViewCustom.cpp:
+        (WebCore::V8DataView::constructorCallback):
+        * bindings/v8/custom/V8SVGLengthCustom.cpp:
+        (WebCore::V8SVGLength::valueAccessorSetter):
+        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+        (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
+        (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getUniformCallback):
+        (WebCore::vertexAttribAndUniformHelperf):
+        (WebCore::uniformHelperi):
+        (WebCore::uniformMatrixHelper):
+
 2012-05-22  Yoshifumi Inoue  <[email protected]>
 
         [Forms][Meter][Progress] Change function signature of parseToDoubleForNumberType

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (117932 => 117933)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-22 08:38:34 UTC (rev 117933)
@@ -1054,7 +1054,7 @@
         my $argType = GetTypeFromSignature($attribute->signature);
         if (IsWrapperType($argType)) {
             push(@implContentDecls, "    if (!isUndefinedOrNull(value) && !V8${argType}::HasInstance(value)) {\n");
-            push(@implContentDecls, "        V8Proxy::throwTypeError();\n");
+            push(@implContentDecls, "        V8Proxy::throwTypeError(0, info.GetIsolate());\n");
             push(@implContentDecls, "        return;\n");
             push(@implContentDecls, "    }\n");
         }
@@ -1354,7 +1354,7 @@
         push(@implContentDecls, "        return ${name}$overload->{overloadIndex}Callback(args);\n");
     }
     push(@implContentDecls, <<END);
-    V8Proxy::throwTypeError();
+    V8Proxy::throwTypeError(0, args.GetIsolate());
     return v8::Handle<v8::Value>();
 END
     push(@implContentDecls, "}\n\n");
@@ -1663,7 +1663,7 @@
                 my $argType = GetTypeFromSignature($parameter);
                 if (IsWrapperType($argType)) {
                     $parameterCheckString .= "    if (args.Length() > $paramIndex && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue)) {\n";
-                    $parameterCheckString .= "        V8Proxy::throwTypeError();\n";
+                    $parameterCheckString .= "        V8Proxy::throwTypeError(0, args.GetIsolate());\n";
                     $parameterCheckString .= "        return v8::Handle<v8::Value>();\n";
                     $parameterCheckString .= "    }\n";
                 }

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (117932 => 117933)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-05-22 08:38:34 UTC (rev 117933)
@@ -1813,7 +1813,7 @@
         return overloadedMethod6Callback(args);
     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsArray())))
         return overloadedMethod7Callback(args);
-    V8Proxy::throwTypeError();
+    V8Proxy::throwTypeError(0, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
@@ -1871,7 +1871,7 @@
         return overloadedMethod11Callback(args);
     if ((args.Length() == 1 && (args[0]->IsNull() || args[0]->IsUndefined() || args[0]->IsString() || args[0]->IsObject())))
         return overloadedMethod12Callback(args);
-    V8Proxy::throwTypeError();
+    V8Proxy::throwTypeError(0, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-05-22 08:38:34 UTC (rev 117933)
@@ -631,9 +631,9 @@
     }
 }
 
-v8::Handle<v8::Value> V8Proxy::throwTypeError(const char* message)
+v8::Handle<v8::Value> V8Proxy::throwTypeError(const char* message, v8::Isolate* isolate)
 {
-    return throwError(TypeError, (message ? message : "Type error"));
+    return throwError(TypeError, (message ? message : "Type error"), isolate);
 }
 
 v8::Handle<v8::Value> V8Proxy::throwNotEnoughArgumentsError(v8::Isolate* isolate)

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-05-22 08:38:34 UTC (rev 117933)
@@ -240,7 +240,7 @@
         static v8::Handle<v8::Value> throwError(ErrorType, const char* message, v8::Isolate* = 0);
 
         // Helpers for throwing syntax and type errors with predefined messages.
-        static v8::Handle<v8::Value> throwTypeError(const char* = 0);
+        static v8::Handle<v8::Value> throwTypeError(const char* = 0, v8::Isolate* = 0);
         static v8::Handle<v8::Value> throwNotEnoughArgumentsError(v8::Isolate*);
 
         v8::Local<v8::Context> context();

Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-05-22 08:38:34 UTC (rev 117933)
@@ -138,8 +138,7 @@
 
     if (args[0]->IsNull()) {
         // Invalid first argument
-        // FIXME: use forthcoming V8Proxy::throwTypeError().
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     }
 
     // See whether the first argument is a ArrayBuffer.

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp	2012-05-22 08:38:34 UTC (rev 117933)
@@ -53,7 +53,7 @@
         return args.Holder();
     }
     if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-05-22 08:38:34 UTC (rev 117933)
@@ -66,7 +66,7 @@
     }
 
     if (!isUndefinedOrNull(value) && !value->IsNumber() && !value->IsBoolean()) {
-        V8Proxy::throwTypeError();
+        V8Proxy::throwTypeError(0, info.GetIsolate());
         return;
     }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp (117932 => 117933)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2012-05-22 08:36:20 UTC (rev 117932)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2012-05-22 08:38:34 UTC (rev 117933)
@@ -274,7 +274,7 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     Vector<RefPtr<WebGLShader> > shaders;
     bool succeed = context->getAttachedShaders(program, shaders, ec);
@@ -355,7 +355,7 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     unsigned pname = toInt32(args[1]);
     WebGLGetInfo info = context->getProgramParameter(program, pname, ec);
@@ -382,7 +382,7 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLShader::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     unsigned pname = toInt32(args[1]);
     WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
@@ -423,11 +423,11 @@
     ExceptionCode ec = 0;
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLProgram::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
 
     if (args.Length() > 1 && !isUndefinedOrNull(args[1]) && !V8WebGLUniformLocation::HasInstance(args[1]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     bool ok = false;
     WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
 
@@ -495,7 +495,7 @@
         index = toInt32(args[0]);
     else {
         if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
-            return V8Proxy::throwTypeError();
+            return V8Proxy::throwTypeError(0, args.GetIsolate());
         location = toWebGLUniformLocation(args[0], ok);
     }
 
@@ -522,7 +522,7 @@
     }
 
     if (args[1].IsEmpty() || !args[1]->IsArray())
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     v8::Handle<v8::Array> array =
       v8::Local<v8::Array>::Cast(args[1]);
     uint32_t len = array->Length();
@@ -567,7 +567,7 @@
 
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     bool ok = false;
     WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
 
@@ -588,7 +588,7 @@
     }
 
     if (args[1].IsEmpty() || !args[1]->IsArray())
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     v8::Handle<v8::Array> array =
       v8::Local<v8::Array>::Cast(args[1]);
     uint32_t len = array->Length();
@@ -678,7 +678,7 @@
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
 
     if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8WebGLUniformLocation::HasInstance(args[0]))
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     bool ok = false;
     WebGLUniformLocation* location = toWebGLUniformLocation(args[0], ok);
     
@@ -699,7 +699,7 @@
     }
 
     if (args[2].IsEmpty() || !args[2]->IsArray())
-        return V8Proxy::throwTypeError();
+        return V8Proxy::throwTypeError(0, args.GetIsolate());
     v8::Handle<v8::Array> array =
       v8::Local<v8::Array>::Cast(args[2]);
     uint32_t len = array->Length();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to