Changeset 117725 in webkit


Ignore:
Timestamp:
May 20, 2012 10:03:33 PM (12 years ago)
Author:
haraken@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117724 r117725  
     12012-05-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Pass Isolate to throwError()s in CodeGeneratorV8.pm
     4        https://bugs.webkit.org/show_bug.cgi?id=86976
     5
     6        Reviewed by Adam Barth.
     7
     8        The objective is to pass Isolate around in V8 bindings.
     9        This patch passes Isolate to throwError()s in CodeGeneratorV8.pm.
     10
     11        No tests. No change in behavior.
     12
     13        * bindings/scripts/CodeGeneratorV8.pm:
     14        (GenerateNormalAttrGetter):
     15        (GenerateNormalAttrSetter):
     16        (GenerateParametersCheck):
     17        (GenerateConstructorCallback):
     18        (GenerateNamedConstructorCallback):
     19        (GenerateFunctionCallString):
     20        * bindings/scripts/test/V8/V8TestInterface.cpp:
     21        (WebCore::V8TestInterface::constructorCallback):
     22        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     23        (WebCore::V8TestNamedConstructorConstructorCallback):
     24        * bindings/scripts/test/V8/V8TestObj.cpp:
     25        (WebCore::TestObjV8Internal::withScriptStateAttributeAttrSetter):
     26        (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrGetter):
     27        (WebCore::TestObjV8Internal::withScriptStateAttributeRaisesAttrSetter):
     28        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeAttrSetter):
     29        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrGetter):
     30        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateAttributeRaisesAttrSetter):
     31        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesAttributeAttrSetter):
     32        (WebCore::TestObjV8Internal::withScriptStateVoidCallback):
     33        (WebCore::TestObjV8Internal::withScriptStateObjCallback):
     34        (WebCore::TestObjV8Internal::withScriptStateVoidExceptionCallback):
     35        (WebCore::TestObjV8Internal::withScriptStateObjExceptionCallback):
     36        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateCallback):
     37        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateObjExceptionCallback):
     38        (WebCore::TestObjV8Internal::withScriptExecutionContextAndScriptStateWithSpacesCallback):
     39        (WebCore::TestObjV8Internal::methodWithCallbackArgCallback):
     40        (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):
     41        (WebCore::TestObjV8Internal::methodWithCallbackAndOptionalArgCallback):
     42        (WebCore::TestObjV8Internal::overloadedMethod5Callback):
     43        (WebCore::V8TestObj::constructorCallback):
     44
    1452012-05-20  George Staikos  <staikos@webkit.org>
    246
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r117507 r117725  
    895895        if ($codeGenerator->ExtendedAttributeContains($attribute->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
    896896            push(@implContentDecls, "    if (state.hadException())\n");
    897             push(@implContentDecls, "        return throwError(state.exception());\n");
     897            push(@implContentDecls, "        return throwError(state.exception(), info.GetIsolate());\n");
    898898        }
    899899
     
    11861186    if ($codeGenerator->ExtendedAttributeContains($attribute->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
    11871187        push(@implContentDecls, "    if (state.hadException())\n");
    1188         push(@implContentDecls, "        throwError(state.exception());\n");
     1188        push(@implContentDecls, "        throwError(state.exception(), info.GetIsolate());\n");
    11891189    }
    11901190
     
    15911591                $parameterCheckString .= "    if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n";
    15921592                $parameterCheckString .= "        if (!args[$paramIndex]->IsFunction())\n";
    1593                 $parameterCheckString .= "            return throwError(TYPE_MISMATCH_ERR);\n";
     1593                $parameterCheckString .= "            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
    15941594                $parameterCheckString .= "        $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
    15951595                $parameterCheckString .= "    }\n";
    15961596            } else {
    15971597                $parameterCheckString .= "    if (args.Length() <= $paramIndex || !args[$paramIndex]->IsFunction())\n";
    1598                 $parameterCheckString .= "        return throwError(TYPE_MISMATCH_ERR);\n";
     1598                $parameterCheckString .= "        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());\n";
    15991599                $parameterCheckString .= "    RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n";
    16001600            }
     
    17401740    ScriptExecutionContext* context = getScriptExecutionContext();
    17411741    if (!context)
    1742         return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available");
     1742        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available", args.GetIsolate());
    17431743END
    17441744    }
     
    17801780    if ($raisesExceptions) {
    17811781        push(@implContent, "  fail:\n");
    1782         push(@implContent, "    return throwError(ec);\n");
     1782        push(@implContent, "    return throwError(ec, args.GetIsolate());\n");
    17831783    }
    17841784
     
    18961896    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    18971897    if (!frame)
    1898         return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable");
     1898        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable", args.GetIsolate());
    18991899
    19001900    Document* document = frame->document();
     
    19551955    if ($raisesExceptions) {
    19561956        push(@implContent, "  fail:\n");
    1957         push(@implContent, "    return throwError(ec);\n");
     1957        push(@implContent, "    return throwError(ec, args.GetIsolate());\n");
    19581958    }
    19591959
     
    33353335    if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptState")) {
    33363336        $result .= $indent . "if (state.hadException())\n";
    3337         $result .= $indent . "    return throwError(state.exception());\n"
     3337        $result .= $indent . "    return throwError(state.exception(), args.GetIsolate());\n"
    33383338    }
    33393339
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r117507 r117725  
    222222    ScriptExecutionContext* context = getScriptExecutionContext();
    223223    if (!context)
    224         return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available");
     224        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available", args.GetIsolate());
    225225
    226226    RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
     
    233233    return args.Holder();
    234234  fail:
    235     return throwError(ec);
     235    return throwError(ec, args.GetIsolate());
    236236}
    237237
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r117507 r117725  
    5656    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    5757    if (!frame)
    58         return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable");
     58        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable", args.GetIsolate());
    5959
    6060    Document* document = frame->document();
     
    8181    return args.Holder();
    8282  fail:
    83     return throwError(ec);
     83    return throwError(ec, args.GetIsolate());
    8484}
    8585
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r117507 r117725  
    728728    imp->setWithScriptStateAttribute(state, v);
    729729    if (state.hadException())
    730         throwError(state.exception());
     730        throwError(state.exception(), info.GetIsolate());
    731731    return;
    732732}
     
    768768    }
    769769    if (state.hadException())
    770         return throwError(state.exception());
     770        return throwError(state.exception(), info.GetIsolate());
    771771    return toV8(v.release(), info.GetIsolate());
    772772}
     
    785785        V8Proxy::setDOMException(ec, info.GetIsolate());
    786786    if (state.hadException())
    787         throwError(state.exception());
     787        throwError(state.exception(), info.GetIsolate());
    788788    return;
    789789}
     
    846846    imp->setWithScriptExecutionContextAndScriptStateAttribute(state, scriptContext, WTF::getPtr(v));
    847847    if (state.hadException())
    848         throwError(state.exception());
     848        throwError(state.exception(), info.GetIsolate());
    849849    return;
    850850}
     
    867867    }
    868868    if (state.hadException())
    869         return throwError(state.exception());
     869        return throwError(state.exception(), info.GetIsolate());
    870870    return toV8(v.release(), info.GetIsolate());
    871871}
     
    887887        V8Proxy::setDOMException(ec, info.GetIsolate());
    888888    if (state.hadException())
    889         throwError(state.exception());
     889        throwError(state.exception(), info.GetIsolate());
    890890    return;
    891891}
     
    917917    imp->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, scriptContext, WTF::getPtr(v));
    918918    if (state.hadException())
    919         throwError(state.exception());
     919        throwError(state.exception(), info.GetIsolate());
    920920    return;
    921921}
     
    14111411    imp->withScriptStateVoid(&state);
    14121412    if (state.hadException())
    1413         return throwError(state.exception());
     1413        return throwError(state.exception(), args.GetIsolate());
    14141414    return v8::Handle<v8::Value>();
    14151415}
     
    14221422    RefPtr<TestObj> result = imp->withScriptStateObj(&state);
    14231423    if (state.hadException())
    1424         return throwError(state.exception());
     1424        return throwError(state.exception(), args.GetIsolate());
    14251425    return toV8(result.release(), args.GetIsolate());
    14261426}
     
    14371437        goto fail;
    14381438    if (state.hadException())
    1439         return throwError(state.exception());
     1439        return throwError(state.exception(), args.GetIsolate());
    14401440    return v8::Handle<v8::Value>();
    14411441    }
     
    14561456        goto fail;
    14571457    if (state.hadException())
    1458         return throwError(state.exception());
     1458        return throwError(state.exception(), args.GetIsolate());
    14591459    return toV8(result.release(), args.GetIsolate());
    14601460    }
     
    14851485    imp->withScriptExecutionContextAndScriptState(&state, scriptContext);
    14861486    if (state.hadException())
    1487         return throwError(state.exception());
     1487        return throwError(state.exception(), args.GetIsolate());
    14881488    return v8::Handle<v8::Value>();
    14891489}
     
    15031503        goto fail;
    15041504    if (state.hadException())
    1505         return throwError(state.exception());
     1505        return throwError(state.exception(), args.GetIsolate());
    15061506    return toV8(result.release(), args.GetIsolate());
    15071507    }
     
    15211521    RefPtr<TestObj> result = imp->withScriptExecutionContextAndScriptStateWithSpaces(&state, scriptContext);
    15221522    if (state.hadException())
    1523         return throwError(state.exception());
     1523        return throwError(state.exception(), args.GetIsolate());
    15241524    return toV8(result.release(), args.GetIsolate());
    15251525}
     
    16251625    TestObj* imp = V8TestObj::toNative(args.Holder());
    16261626    if (args.Length() <= 0 || !args[0]->IsFunction())
    1627         return throwError(TYPE_MISMATCH_ERR);
     1627        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    16281628    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
    16291629    imp->methodWithCallbackArg(callback);
     
    16391639    EXCEPTION_BLOCK(int, nonCallback, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
    16401640    if (args.Length() <= 1 || !args[1]->IsFunction())
    1641         return throwError(TYPE_MISMATCH_ERR);
     1641        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    16421642    RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
    16431643    imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
     
    16521652    if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) {
    16531653        if (!args[0]->IsFunction())
    1654             return throwError(TYPE_MISMATCH_ERR);
     1654            return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    16551655        callback = V8TestCallback::create(args[0], getScriptExecutionContext());
    16561656    }
     
    17511751    TestObj* imp = V8TestObj::toNative(args.Holder());
    17521752    if (args.Length() <= 0 || !args[0]->IsFunction())
    1753         return throwError(TYPE_MISMATCH_ERR);
     1753        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    17541754    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
    17551755    imp->overloadedMethod(callback);
     
    22422242        return V8Proxy::throwNotEnoughArgumentsError();
    22432243    if (args.Length() <= 0 || !args[0]->IsFunction())
    2244         return throwError(TYPE_MISMATCH_ERR);
     2244        return throwError(TYPE_MISMATCH_ERR, args.GetIsolate());
    22452245    RefPtr<TestCallback> testCallback = V8TestCallback::create(args[0], getScriptExecutionContext());
    22462246
Note: See TracChangeset for help on using the changeset viewer.