Title: [117725] trunk/Source/WebCore
Revision
117725
Author
[email protected]
Date
2012-05-20 22:03:33 -0700 (Sun, 20 May 2012)

Log Message

[V8] Pass Isolate to throwError()s in CodeGeneratorV8.pm
https://bugs.webkit.org/show_bug.cgi?id=86976

Reviewed by Adam Barth.

The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to throwError()s in CodeGeneratorV8.pm.

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateNormalAttrGetter):
(GenerateNormalAttrSetter):
(GenerateParametersCheck):
(GenerateConstructorCallback):
(GenerateNamedConstructorCallback):
(GenerateFunctionCallString):
* bindings/scripts/test/V8/V8TestInterface.cpp:
(WebCore::V8TestInterface::constructorCallback):
* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
(WebCore::V8TestNamedConstructorConstructorCallback):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::withScriptStateAttributeAttrSetter):
(WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter):
(WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrSetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter):
(WebCore::TestObjV8Internal::withScriptStateVoidCallback):
(WebCore::TestObjV8Internal::withScriptStateObjCallback):
(WebCore::TestObjV8Internal::withScriptStateVoidExceptionCallback):
(WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateCallback):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback):
(WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback):
(WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
(WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
(WebCore::TestObjV8Internal::methodWithCallbackAndOptionalArgCallback):
(WebCore::TestObjV8Internal::overloadedMethod5Callback):
(WebCore::V8TestObj::constructorCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117724 => 117725)


--- trunk/Source/WebCore/ChangeLog	2012-05-21 02:44:05 UTC (rev 117724)
+++ trunk/Source/WebCore/ChangeLog	2012-05-21 05:03:33 UTC (rev 117725)
@@ -1,3 +1,47 @@
+2012-05-20  Kentaro Hara  <[email protected]>
+
+        [V8] Pass Isolate to throwError()s in CodeGeneratorV8.pm
+        https://bugs.webkit.org/show_bug.cgi?id=86976
+
+        Reviewed by Adam Barth.
+
+        The objective is to pass Isolate around in V8 bindings.
+        This patch passes Isolate to throwError()s in CodeGeneratorV8.pm.
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateNormalAttrGetter):
+        (GenerateNormalAttrSetter):
+        (GenerateParametersCheck):
+        (GenerateConstructorCallback):
+        (GenerateNamedConstructorCallback):
+        (GenerateFunctionCallString):
+        * bindings/scripts/test/V8/V8TestInterface.cpp:
+        (WebCore::V8TestInterface::constructorCallback):
+        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
+        (WebCore::V8TestNamedConstructorConstructorCallback):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjV8Internal::withScriptStateAttributeAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter):
+        (WebCore::TestObjV8Internal::withScriptStateVoidCallback):
+        (WebCore::TestObjV8Internal::withScriptStateObjCallback):
+        (WebCore::TestObjV8Internal::withScriptStateVoidExceptionCallback):
+        (WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateCallback):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback):
+        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback):
+        (WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
+        (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
+        (WebCore::TestObjV8Internal::methodWithCallbackAndOptionalArgCallback):
+        (WebCore::TestObjV8Internal::overloadedMethod5Callback):
+        (WebCore::V8TestObj::constructorCallback):
+
 2012-05-20  George Staikos  <[email protected]>
 
         [BlackBerry] Implement the Screen functions to get DPI.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (117724 => 117725)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-21 02:44:05 UTC (rev 117724)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-21 05:03:33 UTC (rev 117725)
@@ -894,7 +894,7 @@
 
         if ($codeGenerator->ExtendedAttributeContains($attribute->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
             push(@implContentDecls, "    if (state.hadException())\n");
-            push(@implContentDecls, "        return throwError(state.exception());\n");
+            push(@implContentDecls, "        return throwError(state.exception(), info.GetIsolate());\n");
         }
 
         $result = "v";
@@ -1185,7 +1185,7 @@
 
     if ($codeGenerator->ExtendedAttributeContains($attribute->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
         push(@implContentDecls, "    if (state.hadException())\n");
-        push(@implContentDecls, "        throwError(state.exception());\n");
+        push(@implContentDecls, "        throwError(state.exception(), info.GetIsolate());\n");
     }
 
     if ($svgNativeType) {
@@ -1590,12 +1590,12 @@
                 $parameterCheckString .= "    RefPtr<" . $parameter->type . "> $parameterName;\n";
                 $parameterCheckString .= "    if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n";
                 $parameterCheckString .= "        if (!args[$paramIndex]->IsFunction())\n";
-                $parameterCheckString .= "            return throwError(TYPE_MISMATCH_ERR);\n";
+                $parameterCheckString .= "            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
                 $parameterCheckString .= "        $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
                 $parameterCheckString .= "    }\n";
             } else {
                 $parameterCheckString .= "    if (args.Length() <= $paramIndex || !args[$paramIndex]->IsFunction())\n";
-                $parameterCheckString .= "        return throwError(TYPE_MISMATCH_ERR);\n";
+                $parameterCheckString .= "        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
                 $parameterCheckString .= "    RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
             }
         } elsif ($parameter->type eq "SerializedScriptValue") {
@@ -1739,7 +1739,7 @@
 
     ScriptExecutionContext* context = getScriptExecutionContext();
     if (!context)
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available", args.GetIsolate());
 END
     }
 
@@ -1779,7 +1779,7 @@
 
     if ($raisesExceptions) {
         push(@implContent, "  fail:\n");
-        push(@implContent, "    return throwError(ec);\n");
+        push(@implContent, "    return throwError(ec, args.GetIsolate());\n");
     }
 
     push(@implContent, "}\n");
@@ -1895,7 +1895,7 @@
 
     Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
     if (!frame)
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable", args.GetIsolate());
 
     Document* document = frame->document();
 
@@ -1954,7 +1954,7 @@
 
     if ($raisesExceptions) {
         push(@implContent, "  fail:\n");
-        push(@implContent, "    return throwError(ec);\n");
+        push(@implContent, "    return throwError(ec, args.GetIsolate());\n");
     }
 
     push(@implContent, "}\n");
@@ -3334,7 +3334,7 @@
 
     if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptState")) {
         $result .= $indent . "if (state.hadException())\n";
-        $result .= $indent . "    return throwError(state.exception());\n"
+        $result .= $indent . "    return throwError(state.exception(), args.GetIsolate());\n"
     }
 
     if ($isSVGTearOffType) {

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp (117724 => 117725)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp	2012-05-21 02:44:05 UTC (rev 117724)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp	2012-05-21 05:03:33 UTC (rev 117725)
@@ -221,7 +221,7 @@
 
     ScriptExecutionContext* context = getScriptExecutionContext();
     if (!context)
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available", args.GetIsolate());
 
     RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
     v8::Handle<v8::Object> wrapper = args.Holder();
@@ -232,7 +232,7 @@
     V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent<v8::Object>::New(wrapper), args.GetIsolate());
     return args.Holder();
   fail:
-    return throwError(ec);
+    return throwError(ec, args.GetIsolate());
 }
 
 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp (117724 => 117725)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp	2012-05-21 02:44:05 UTC (rev 117724)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp	2012-05-21 05:03:33 UTC (rev 117725)
@@ -55,7 +55,7 @@
 
     Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
     if (!frame)
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable", args.GetIsolate());
 
     Document* document = frame->document();
 
@@ -80,7 +80,7 @@
     V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent<v8::Object>::New(wrapper), args.GetIsolate());
     return args.Holder();
   fail:
-    return throwError(ec);
+    return throwError(ec, args.GetIsolate());
 }
 
 v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate()

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


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-05-21 02:44:05 UTC (rev 117724)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-05-21 05:03:33 UTC (rev 117725)
@@ -727,7 +727,7 @@
         return;
     imp->setWithScriptStateAttribute(state, v);
     if (state.hadException())
-        throwError(state.exception());
+        throwError(state.exception(), info.GetIsolate());
     return;
 }
 
@@ -767,7 +767,7 @@
         return v8::Handle<v8::Value>();
     }
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), info.GetIsolate());
     return toV8(v.release(), info.GetIsolate());
 }
 
@@ -784,7 +784,7 @@
     if (UNLIKELY(ec))
         V8Proxy::setDOMException(ec, info.GetIsolate());
     if (state.hadException())
-        throwError(state.exception());
+        throwError(state.exception(), info.GetIsolate());
     return;
 }
 
@@ -845,7 +845,7 @@
         return;
     imp->setWithScriptExecutionContextAndScriptStateAttribute(state, scriptContext, WTF::getPtr(v));
     if (state.hadException())
-        throwError(state.exception());
+        throwError(state.exception(), info.GetIsolate());
     return;
 }
 
@@ -866,7 +866,7 @@
         return v8::Handle<v8::Value>();
     }
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), info.GetIsolate());
     return toV8(v.release(), info.GetIsolate());
 }
 
@@ -886,7 +886,7 @@
     if (UNLIKELY(ec))
         V8Proxy::setDOMException(ec, info.GetIsolate());
     if (state.hadException())
-        throwError(state.exception());
+        throwError(state.exception(), info.GetIsolate());
     return;
 }
 
@@ -916,7 +916,7 @@
         return;
     imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext, WTF::getPtr(v));
     if (state.hadException())
-        throwError(state.exception());
+        throwError(state.exception(), info.GetIsolate());
     return;
 }
 
@@ -1410,7 +1410,7 @@
     EmptyScriptState state;
     imp->withScriptStateVoid(&state);
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
@@ -1421,7 +1421,7 @@
     EmptyScriptState state;
     RefPtr<TestObj> result = imp->withScriptStateObj(&state);
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
 }
 
@@ -1436,7 +1436,7 @@
     if (UNLIKELY(ec))
         goto fail;
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return v8::Handle<v8::Value>();
     }
     fail:
@@ -1455,7 +1455,7 @@
     if (UNLIKELY(ec))
         goto fail;
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
     }
     fail:
@@ -1484,7 +1484,7 @@
         return v8::Undefined();
     imp->withScriptExecutionContextAndScriptState(&state, scriptContext);
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
@@ -1502,7 +1502,7 @@
     if (UNLIKELY(ec))
         goto fail;
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
     }
     fail:
@@ -1520,7 +1520,7 @@
         return v8::Undefined();
     RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext);
     if (state.hadException())
-        return throwError(state.exception());
+        return throwError(state.exception(), args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
 }
 
@@ -1624,7 +1624,7 @@
         return V8Proxy::throwNotEnoughArgumentsError();
     TestObj* imp = V8TestObj::toNative(args.Holder());
     if (args.Length() <= 0 || !args[0]->IsFunction())
-        return throwError(TYPE_MISMATCH_ERR);
+        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     imp->methodWithCallbackArg(callback);
     return v8::Handle<v8::Value>();
@@ -1638,7 +1638,7 @@
     TestObj* imp = V8TestObj::toNative(args.Holder());
     EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
     if (args.Length() <= 1 || !args[1]->IsFunction())
-        return throwError(TYPE_MISMATCH_ERR);
+        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
     RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
     return v8::Handle<v8::Value>();
@@ -1651,7 +1651,7 @@
     RefPtr<TestCallback> callback;
     if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
         if (!args[0]->IsFunction())
-            return throwError(TYPE_MISMATCH_ERR);
+            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     }
     imp->methodWithCallbackAndOptionalArg(callback);
@@ -1750,7 +1750,7 @@
         return V8Proxy::throwNotEnoughArgumentsError();
     TestObj* imp = V8TestObj::toNative(args.Holder());
     if (args.Length() <= 0 || !args[0]->IsFunction())
-        return throwError(TYPE_MISMATCH_ERR);
+        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
     RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     imp->overloadedMethod(callback);
     return v8::Handle<v8::Value>();
@@ -2241,7 +2241,7 @@
     if (args.Length() < 1)
         return V8Proxy::throwNotEnoughArgumentsError();
     if (args.Length() <= 0 || !args[0]->IsFunction())
-        return throwError(TYPE_MISMATCH_ERR);
+        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
     RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext());
 
     RefPtr<TestObj> impl = TestObj::create(testCallback);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to