Changeset 117507 in webkit


Ignore:
Timestamp:
May 17, 2012 3:35:07 PM (12 years ago)
Author:
haraken@chromium.org
Message:

[V8][Refactoring] Remove throwError("message", XXXError) from CodeGeneratorV8.pm
https://bugs.webkit.org/show_bug.cgi?id=86744

Reviewed by Adam Barth.

As commented in https://bugs.webkit.org/show_bug.cgi?id=84074#c5,
I am refactoring a series of confusing throwError()s.

This patch removes throwError("message", XXXError) in CodeGeneratorV8.pm
and replaces it with throwTypeError("message") or throwError(XXXError, "message").

No tests. No change in behavior.

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateParametersCheck):
(GenerateConstructorCallback):
(GenerateEventConstructorCallback):
(GenerateNamedConstructorCallback):

  • bindings/scripts/test/V8/V8TestEventConstructor.cpp:

(WebCore::V8TestEventConstructor::constructorCallback):

  • bindings/scripts/test/V8/V8TestInterface.cpp:

(WebCore::V8TestInterface::constructorCallback):

  • bindings/scripts/test/V8/V8TestNamedConstructor.cpp:

(WebCore::V8TestNamedConstructorConstructorCallback):

  • bindings/scripts/test/V8/V8TestNode.cpp:

(WebCore::V8TestNode::constructorCallback):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore::TestObjV8Internal::optionsObjectCallback):
(WebCore::V8TestObj::constructorCallback):

  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:

(WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
(WebCore::TestSerializedScriptValueInterfaceV8Internal::multiTransferListCallback):
(WebCore::V8TestSerializedScriptValueInterface::constructorCallback):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117506 r117507  
     12012-05-17  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8][Refactoring] Remove throwError("message", XXXError) from CodeGeneratorV8.pm
     4        https://bugs.webkit.org/show_bug.cgi?id=86744
     5
     6        Reviewed by Adam Barth.
     7
     8        As commented in https://bugs.webkit.org/show_bug.cgi?id=84074#c5,
     9        I am refactoring a series of confusing throwError()s.
     10
     11        This patch removes throwError("message", XXXError) in CodeGeneratorV8.pm
     12        and replaces it with throwTypeError("message") or throwError(XXXError, "message").
     13
     14        No tests. No change in behavior.
     15
     16        * bindings/scripts/CodeGeneratorV8.pm:
     17        (GenerateParametersCheck):
     18        (GenerateConstructorCallback):
     19        (GenerateEventConstructorCallback):
     20        (GenerateNamedConstructorCallback):
     21        * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
     22        (WebCore::V8TestEventConstructor::constructorCallback):
     23        * bindings/scripts/test/V8/V8TestInterface.cpp:
     24        (WebCore::V8TestInterface::constructorCallback):
     25        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     26        (WebCore::V8TestNamedConstructorConstructorCallback):
     27        * bindings/scripts/test/V8/V8TestNode.cpp:
     28        (WebCore::V8TestNode::constructorCallback):
     29        * bindings/scripts/test/V8/V8TestObj.cpp:
     30        (WebCore::TestObjV8Internal::optionsObjectCallback):
     31        (WebCore::V8TestObj::constructorCallback):
     32        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
     33        (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):
     34        (WebCore::TestSerializedScriptValueInterfaceV8Internal::multiTransferListCallback):
     35        (WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
     36
    1372012-05-17  Gregg Tavares  <gman@google.com>
    238
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r117384 r117507  
    16241624                $parameterCheckString .= "    if (args.Length() > $transferListIndex) {\n";
    16251625                $parameterCheckString .= "        if (!extractTransferables(args[$transferListIndex], messagePortArray$TransferListName, arrayBufferArray$TransferListName))\n";
    1626                 $parameterCheckString .= "            return throwError(\"Could not extract transferables\", V8Proxy::TypeError);\n";
     1626                $parameterCheckString .= "            return V8Proxy::throwTypeError(\"Could not extract transferables\");\n";
    16271627                $parameterCheckString .= "    }\n";
    16281628                $useTransferList = 1;
     
    16721672                   $parameterCheckString .= "        V8Proxy::setDOMException(ec, args.GetIsolate());\n";
    16731673               }
    1674                $parameterCheckString .= "        return throwError(\"Not an object.\", V8Proxy::TypeError);\n";
     1674               $parameterCheckString .= "        return V8Proxy::throwTypeError(\"Not an object.\");\n";
    16751675               $parameterCheckString .= "    }\n";
    16761676            }
     
    17151715
    17161716    if (!args.IsConstructCall())
    1717         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     1717        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    17181718
    17191719    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    17401740    ScriptExecutionContext* context = getScriptExecutionContext();
    17411741    if (!context)
    1742         return throwError("${implClassName} constructor's associated context is not available", V8Proxy::ReferenceError);
     1742        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor's associated context is not available");
    17431743END
    17441744    }
     
    18001800
    18011801    if (!args.IsConstructCall())
    1802         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     1802        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    18031803
    18041804    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    18891889
    18901890    if (!args.IsConstructCall())
    1891         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     1891        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    18921892
    18931893    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    18961896    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    18971897    if (!frame)
    1898         return throwError("${implClassName} constructor associated frame is unavailable", V8Proxy::ReferenceError);
     1898        return V8Proxy::throwError(V8Proxy::ReferenceError, "${implClassName} constructor associated frame is unavailable");
    18991899
    19001900    Document* document = frame->document();
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp

    r115797 r117507  
    6868
    6969    if (!args.IsConstructCall())
    70         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     70        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    7171
    7272    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r116269 r117507  
    209209
    210210    if (!args.IsConstructCall())
    211         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     211        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    212212
    213213    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    222222    ScriptExecutionContext* context = getScriptExecutionContext();
    223223    if (!context)
    224         return throwError("TestInterface constructor's associated context is not available", V8Proxy::ReferenceError);
     224        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestInterface constructor's associated context is not available");
    225225
    226226    RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, ec);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r115797 r117507  
    4949
    5050    if (!args.IsConstructCall())
    51         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     51        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    5252
    5353    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    5656    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
    5757    if (!frame)
    58         return throwError("TestNamedConstructor constructor associated frame is unavailable", V8Proxy::ReferenceError);
     58        return V8Proxy::throwError(V8Proxy::ReferenceError, "TestNamedConstructor constructor associated frame is unavailable");
    5959
    6060    Document* document = frame->document();
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp

    r115797 r117507  
    4646
    4747    if (!args.IsConstructCall())
    48         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     48        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    4949
    5050    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r116269 r117507  
    13521352    EXCEPTION_BLOCK(Dictionary, oo, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    13531353    if (args.Length() > 0 && !oo.isUndefinedOrNull() && !oo.isObject()) {
    1354         return throwError("Not an object.", V8Proxy::TypeError);
     1354        return V8Proxy::throwTypeError("Not an object.");
    13551355    }
    13561356    if (args.Length() <= 1) {
     
    13601360    EXCEPTION_BLOCK(Dictionary, ooo, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
    13611361    if (args.Length() > 1 && !ooo.isUndefinedOrNull() && !ooo.isObject()) {
    1362         return throwError("Not an object.", V8Proxy::TypeError);
     1362        return V8Proxy::throwTypeError("Not an object.");
    13631363    }
    13641364    imp->optionsObject(oo, ooo);
     
    22352235
    22362236    if (!args.IsConstructCall())
    2237         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     2237        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    22382238
    22392239    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r117384 r117507  
    131131    if (args.Length() > 1) {
    132132        if (!extractTransferables(args[1], messagePortArrayTransferList, arrayBufferArrayTransferList))
    133             return throwError("Could not extract transferables", V8Proxy::TypeError);
     133            return V8Proxy::throwTypeError("Could not extract transferables");
    134134    }
    135135    bool dataDidThrow = false;
     
    157157    if (args.Length() > 1) {
    158158        if (!extractTransferables(args[1], messagePortArrayTx, arrayBufferArrayTx))
    159             return throwError("Could not extract transferables", V8Proxy::TypeError);
     159            return V8Proxy::throwTypeError("Could not extract transferables");
    160160    }
    161161    bool firstDidThrow = false;
     
    175175    if (args.Length() > 3) {
    176176        if (!extractTransferables(args[3], messagePortArrayTxx, arrayBufferArrayTxx))
    177             return throwError("Could not extract transferables", V8Proxy::TypeError);
     177            return V8Proxy::throwTypeError("Could not extract transferables");
    178178    }
    179179    bool secondDidThrow = false;
     
    214214
    215215    if (!args.IsConstructCall())
    216         return throwError("DOM object constructor cannot be called as a function.", V8Proxy::TypeError);
     216        return V8Proxy::throwTypeError("DOM object constructor cannot be called as a function.");
    217217
    218218    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
     
    225225    if (args.Length() > 2) {
    226226        if (!extractTransferables(args[2], messagePortArrayTransferList, arrayBufferArrayTransferList))
    227             return throwError("Could not extract transferables", V8Proxy::TypeError);
     227            return V8Proxy::throwTypeError("Could not extract transferables");
    228228    }
    229229    bool dataDidThrow = false;
Note: See TracChangeset for help on using the changeset viewer.