Changeset 196200 in webkit


Ignore:
Timestamp:
Feb 5, 2016 4:18:41 PM (8 years ago)
Author:
Chris Dumez
Message:

Instance property getters / setters cannot be called on another instance of the same type
https://bugs.webkit.org/show_bug.cgi?id=153895

Reviewed by Gavin Barraclough.

Source/WebCore:

It should be possible to call instance property getters / setters on
other instances of the same type, as per the WEB IDL specification:

This matches the behavior of Firefox.

The issue without our bindings was that the getters / setters were
using |slotBase| instead of |thisValue| and therefore ended up using
the instance the getter was taken from instead of the actual target
object.

Test:
js/instance-property-getter-other-instance.html
js/instance-property-setter-other-instance.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • Have instance getters / setters use thisValue instead of slotBase.
  • In the case of interfaces that have attributes on the instance for compatibility reasons, try the prototype object if |thisValue| does does have the right type, instead of using slotBase like previously. I believe this maintains the original compatibility intention while also behaving correctly when called on another instance.
  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:
  • bindings/scripts/test/JS/JSTestException.cpp:
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
  • bindings/scripts/test/JS/JSTestNode.cpp:
  • bindings/scripts/test/JS/JSTestNondeterministic.cpp:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
  • bindings/scripts/test/JS/JSTestTypedefs.cpp:
  • bindings/scripts/test/JS/JSattribute.cpp:

Rebaseline bindings tests.

LayoutTests:

  • js/dom/script-tests/shadow-navigator-geolocation-in-strict-mode-does-not-throw.js:
  • js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw-expected.txt:

Extend this layout test coverage to cover the getter case in addition to the
setter case. This test covers the compatibility mode where we don't throw.
I made sure to maintain this behavior when refactoring the bindings to avoid
breakage.

  • js/instance-property-getter-other-instance-expected.txt:

Rebaseline now that this test passes.

  • js/instance-property-setter-other-instance-expected.txt: Added.
  • js/instance-property-setter-other-instance.html: Added.

Add test to cover the setter case.

Location:
trunk
Files:
3 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196198 r196200  
     12016-02-05  Chris Dumez  <cdumez@apple.com>
     2
     3        Instance property getters / setters cannot be called on another instance of the same type
     4        https://bugs.webkit.org/show_bug.cgi?id=153895
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        * js/dom/script-tests/shadow-navigator-geolocation-in-strict-mode-does-not-throw.js:
     9        * js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw-expected.txt:
     10        Extend this layout test coverage to cover the getter case in addition to the
     11        setter case. This test covers the compatibility mode where we don't throw.
     12        I made sure to maintain this behavior when refactoring the bindings to avoid
     13        breakage.
     14
     15        * js/instance-property-getter-other-instance-expected.txt:
     16        Rebaseline now that this test passes.
     17
     18        * js/instance-property-setter-other-instance-expected.txt: Added.
     19        * js/instance-property-setter-other-instance.html: Added.
     20        Add test to cover the setter case.
     21
     22
    1232016-02-05  Ryan Haddad  <ryanhaddad@apple.com>
    224
  • trunk/LayoutTests/js/dom/script-tests/shadow-navigator-geolocation-in-strict-mode-does-not-throw.js

    r169710 r196200  
     1'use strict';
     2
    13description("Tests that we don't throw a type error in strict mode when assigning to an instance attribute that shadows navigator.geolocation. See <a href='https://bugs.webkit.org/show_bug.cgi?id=133559'>https://bugs.webkit.org/show_bug.cgi?id=133559</a>");
    24
     
    810}
    911
    10 shouldNotThrow("'use strict'; var myNavigator = createObjectWithPrototype(window.navigator); myNavigator.geolocation = 1");
     12var myNavigator = createObjectWithPrototype(window.navigator)
     13shouldBe("myNavigator.geolocation", "navigator.geolocation");
     14shouldNotThrow("myNavigator.geolocation = 1");
     15shouldBe("myNavigator.geolocation", "navigator.geolocation");
    1116
    1217window.jsTestIsAsync = false;
  • trunk/LayoutTests/js/dom/shadow-navigator-geolocation-in-strict-mode-does-not-throw-expected.txt

    r178527 r196200  
     1CONSOLE MESSAGE: line 218: Deprecated attempt to access property 'geolocation' on a non-Navigator object.
    12CONSOLE MESSAGE: line 588: Deprecated attempt to set property 'geolocation' on a non-Navigator object.
     3CONSOLE MESSAGE: line 218: Deprecated attempt to access property 'geolocation' on a non-Navigator object.
    24Tests that we don't throw a type error in strict mode when assigning to an instance attribute that shadows navigator.geolocation. See https://bugs.webkit.org/show_bug.cgi?id=133559
    35
     
    57
    68
    7 PASS 'use strict'; var myNavigator = createObjectWithPrototype(window.navigator); myNavigator.geolocation = 1 did not throw exception.
     9PASS myNavigator.geolocation is navigator.geolocation
     10PASS myNavigator.geolocation = 1 did not throw exception.
     11PASS myNavigator.geolocation is navigator.geolocation
    812PASS successfullyParsed is true
    913
  • trunk/LayoutTests/js/instance-property-getter-other-instance-expected.txt

    r196145 r196200  
    88}
    99PASS locationGetter.call(otherWindow.document).toString() is "about:blank"
    10 FAIL locationGetter.call(window.document) === window.document.location should be true. Was false.
     10PASS locationGetter.call(window.document) === window.document.location is true
    1111PASS successfullyParsed is true
    1212
  • trunk/Source/WebCore/ChangeLog

    r196191 r196200  
     12016-02-05  Chris Dumez  <cdumez@apple.com>
     2
     3        Instance property getters / setters cannot be called on another instance of the same type
     4        https://bugs.webkit.org/show_bug.cgi?id=153895
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        It should be possible to call instance property getters / setters on
     9        other instances of the same type, as per the WEB IDL specification:
     10        - http://heycam.github.io/webidl/#dfn-attribute-getter
     11        - http://heycam.github.io/webidl/#dfn-attribute-setter
     12
     13        This matches the behavior of Firefox.
     14
     15        The issue without our bindings was that the getters / setters were
     16        using |slotBase| instead of |thisValue| and therefore ended up using
     17        the instance the getter was taken from instead of the actual target
     18        object.
     19
     20        Test:
     21        js/instance-property-getter-other-instance.html
     22        js/instance-property-setter-other-instance.html
     23
     24        * bindings/scripts/CodeGeneratorJS.pm:
     25        (GenerateImplementation):
     26        - Have instance getters / setters use thisValue instead of slotBase.
     27        - In the case of interfaces that have attributes on the instance for
     28          compatibility reasons, try the prototype object if |thisValue| does
     29          does have the right type, instead of using slotBase like previously.
     30          I believe this maintains the original compatibility intention while
     31          also behaving correctly when called on another instance.
     32
     33        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
     34        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
     35        * bindings/scripts/test/JS/JSTestException.cpp:
     36        * bindings/scripts/test/JS/JSTestInterface.cpp:
     37        * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
     38        * bindings/scripts/test/JS/JSTestNode.cpp:
     39        * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
     40        * bindings/scripts/test/JS/JSTestObj.cpp:
     41        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     42        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     43        * bindings/scripts/test/JS/JSattribute.cpp:
     44        Rebaseline bindings tests.
     45
    1462016-02-05  Brady Eidson  <beidson@apple.com>
    247
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r196145 r196200  
    22862286            push(@implContent, "    UNUSED_PARAM(thisValue);\n");
    22872287            if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) {
    2288                 my $variableForTypeCheck = "castedThis";
    22892288                if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
    22902289                    push(@implContent, "    auto* castedThis = to${className}(JSValue::decode(thisValue));\n");
    2291                 } elsif (AttributeShouldBeOnInstance($interface, $attribute)) {
    2292                     # FIXME: This does not seem right, we should likely use thisValue instead of slotBase here to match the specification:
    2293                     # http://heycam.github.io/webidl/#dfn-attribute-getter
    2294                     push(@implContent, "    auto* castedThis = jsCast<JS${interfaceName}*>(slotBase);\n");
    2295                     push(@implContent, "    ${className}* castedThisObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
    2296                     $variableForTypeCheck = "castedThisObject";
    22972290                } else {
    22982291                    push(@implContent, "    ${className}* castedThis = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
    22992292                }
    2300                 # FIXME: Getters on a global should not require an explicit this.
    2301                 push(@implContent, "    if (UNLIKELY(!$variableForTypeCheck))\n");
     2293                push(@implContent, "    if (UNLIKELY(!castedThis)) {\n");
    23022294                if ($attribute->signature->extendedAttributes->{"LenientThis"}) {
    23032295                    push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    23042296                } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
     2297                    # Fallback to trying to searching the prototype chain for compatibility reasons.
     2298                    push(@implContent, "        JSObject* thisObject = JSValue::decode(thisValue).getObject();\n");
     2299                    push(@implContent, "        for (thisObject = thisObject ? thisObject->prototype().getObject() : nullptr; thisObject; thisObject = thisObject->prototype().getObject()) {\n");
     2300                    push(@implContent, "            if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n");
     2301                    push(@implContent, "                break;\n");
     2302                    push(@implContent, "        }\n");
     2303                    push(@implContent, "        if (!castedThis)\n");
     2304                    push(@implContent, "            return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
    23052305                    push(@implContent, "        reportDeprecatedGetterError(*state, \"$interfaceName\", \"$name\");\n");
    23062306                } else {
    23072307                    push(@implContent, "        return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
    23082308                }
     2309                push(@implContent, "    }\n");
    23092310            }
    23102311
     
    26232624            push(@implContent, "    UNUSED_PARAM(baseObject);\n");
    26242625            if (!$attribute->isStatic) {
    2625                 my $variableForTypeCheck = "castedThis";
    26262626                if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
    26272627                    push(@implContent, "    ${className}* castedThis = to${className}(JSValue::decode(thisValue));\n");
    2628                 } elsif (AttributeShouldBeOnInstance($interface, $attribute)) {
    2629                     push(@implContent, "    auto* castedThis = jsCast<JS${interfaceName}*>(baseObject);\n");
    2630                     push(@implContent, "    ${className}* castedThisObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
    2631                     $variableForTypeCheck = "castedThisObject";
    26322628                } else {
    26332629                    push(@implContent, "    ${className}* castedThis = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
    26342630                }
    2635                 push(@implContent, "    if (UNLIKELY(!$variableForTypeCheck)) {\n");
     2631                push(@implContent, "    if (UNLIKELY(!castedThis)) {\n");
    26362632                if ($attribute->signature->extendedAttributes->{"LenientThis"}) {
    26372633                    push(@implContent, "        return;\n");
    26382634                } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
     2635                    # Fallback to trying to searching the prototype chain for compatibility reasons.
     2636                    push(@implContent, "        JSObject* thisObject = JSValue::decode(thisValue).getObject();\n");
     2637                    push(@implContent, "        for (thisObject = thisObject ? thisObject->prototype().getObject() : nullptr; thisObject; thisObject = thisObject->prototype().getObject()) {\n");
     2638                    push(@implContent, "            if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n");
     2639                    push(@implContent, "                break;\n");
     2640                    push(@implContent, "        }\n");
     2641                    push(@implContent, "        if (!castedThis)\n");
     2642                    push(@implContent, "            return throwSetterTypeError(*state, \"$interfaceName\", \"$name\");\n");
    26392643                    push(@implContent, "        reportDeprecatedSetterError(*state, \"$interfaceName\", \"$name\");\n");
    26402644                } else {
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp

    r196145 r196200  
    150150    UNUSED_PARAM(slotBase);
    151151    UNUSED_PARAM(thisValue);
    152     auto* castedThis = jsCast<JSTestActiveDOMObject*>(slotBase);
    153     JSTestActiveDOMObject* castedThisObject = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue));
    154     if (UNLIKELY(!castedThisObject))
     152    JSTestActiveDOMObject* castedThis = jsDynamicCast<JSTestActiveDOMObject*>(JSValue::decode(thisValue));
     153    if (UNLIKELY(!castedThis)) {
    155154        return throwGetterTypeError(*state, "TestActiveDOMObject", "excitingAttr");
     155    }
    156156    if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped()))
    157157        return JSValue::encode(jsUndefined());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp

    r195907 r196200  
    163163    UNUSED_PARAM(thisValue);
    164164    JSTestEventConstructor* castedThis = jsDynamicCast<JSTestEventConstructor*>(JSValue::decode(thisValue));
    165     if (UNLIKELY(!castedThis))
     165    if (UNLIKELY(!castedThis)) {
    166166        return throwGetterTypeError(*state, "TestEventConstructor", "attr1");
     167    }
    167168    auto& impl = castedThis->wrapped();
    168169    JSValue result = jsStringWithCache(state, impl.attr1());
     
    177178    UNUSED_PARAM(thisValue);
    178179    JSTestEventConstructor* castedThis = jsDynamicCast<JSTestEventConstructor*>(JSValue::decode(thisValue));
    179     if (UNLIKELY(!castedThis))
     180    if (UNLIKELY(!castedThis)) {
    180181        return throwGetterTypeError(*state, "TestEventConstructor", "attr2");
     182    }
    181183    auto& impl = castedThis->wrapped();
    182184    JSValue result = jsStringWithCache(state, impl.attr2());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp

    r196145 r196200  
    140140    UNUSED_PARAM(slotBase);
    141141    UNUSED_PARAM(thisValue);
    142     auto* castedThis = jsCast<JSTestException*>(slotBase);
    143     JSTestException* castedThisObject = jsDynamicCast<JSTestException*>(JSValue::decode(thisValue));
    144     if (UNLIKELY(!castedThisObject))
     142    JSTestException* castedThis = jsDynamicCast<JSTestException*>(JSValue::decode(thisValue));
     143    if (UNLIKELY(!castedThis)) {
    145144        return throwGetterTypeError(*state, "TestException", "name");
     145    }
    146146    auto& impl = castedThis->wrapped();
    147147    JSValue result = jsStringWithCache(state, impl.name());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r195969 r196200  
    435435    UNUSED_PARAM(thisValue);
    436436    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    437     if (UNLIKELY(!castedThis))
     437    if (UNLIKELY(!castedThis)) {
    438438        return throwGetterTypeError(*state, "TestInterface", "implementsStr1");
     439    }
    439440    auto& impl = castedThis->wrapped();
    440441    JSValue result = jsStringWithCache(state, impl.implementsStr1());
     
    451452    UNUSED_PARAM(thisValue);
    452453    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    453     if (UNLIKELY(!castedThis))
     454    if (UNLIKELY(!castedThis)) {
    454455        return throwGetterTypeError(*state, "TestInterface", "implementsStr2");
     456    }
    455457    auto& impl = castedThis->wrapped();
    456458    JSValue result = jsStringWithCache(state, impl.implementsStr2());
     
    467469    UNUSED_PARAM(thisValue);
    468470    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    469     if (UNLIKELY(!castedThis))
     471    if (UNLIKELY(!castedThis)) {
    470472        return throwGetterTypeError(*state, "TestInterface", "implementsStr3");
     473    }
    471474    return JSValue::encode(castedThis->implementsStr3(*state));
    472475}
     
    481484    UNUSED_PARAM(thisValue);
    482485    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    483     if (UNLIKELY(!castedThis))
     486    if (UNLIKELY(!castedThis)) {
    484487        return throwGetterTypeError(*state, "TestInterface", "implementsNode");
     488    }
    485489    auto& impl = castedThis->wrapped();
    486490    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.implementsNode()));
     
    521525    UNUSED_PARAM(thisValue);
    522526    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    523     if (UNLIKELY(!castedThis))
     527    if (UNLIKELY(!castedThis)) {
    524528        return throwGetterTypeError(*state, "TestInterface", "supplementalStr1");
     529    }
    525530    auto& impl = castedThis->wrapped();
    526531    JSValue result = jsStringWithCache(state, WebCore::TestSupplemental::supplementalStr1(impl));
     
    537542    UNUSED_PARAM(thisValue);
    538543    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    539     if (UNLIKELY(!castedThis))
     544    if (UNLIKELY(!castedThis)) {
    540545        return throwGetterTypeError(*state, "TestInterface", "supplementalStr2");
     546    }
    541547    auto& impl = castedThis->wrapped();
    542548    JSValue result = jsStringWithCache(state, WebCore::TestSupplemental::supplementalStr2(impl));
     
    553559    UNUSED_PARAM(thisValue);
    554560    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    555     if (UNLIKELY(!castedThis))
     561    if (UNLIKELY(!castedThis)) {
    556562        return throwGetterTypeError(*state, "TestInterface", "supplementalStr3");
     563    }
    557564    return JSValue::encode(castedThis->supplementalStr3(*state));
    558565}
     
    567574    UNUSED_PARAM(thisValue);
    568575    JSTestInterface* castedThis = jsDynamicCast<JSTestInterface*>(JSValue::decode(thisValue));
    569     if (UNLIKELY(!castedThis))
     576    if (UNLIKELY(!castedThis)) {
    570577        return throwGetterTypeError(*state, "TestInterface", "supplementalNode");
     578    }
    571579    auto& impl = castedThis->wrapped();
    572580    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(WebCore::TestSupplemental::supplementalNode(impl)));
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp

    r195969 r196200  
    132132    UNUSED_PARAM(thisValue);
    133133    JSTestJSBuiltinConstructor* castedThis = jsDynamicCast<JSTestJSBuiltinConstructor*>(JSValue::decode(thisValue));
    134     if (UNLIKELY(!castedThis))
     134    if (UNLIKELY(!castedThis)) {
    135135        return throwGetterTypeError(*state, "TestJSBuiltinConstructor", "testAttributeCustom");
     136    }
    136137    return JSValue::encode(castedThis->testAttributeCustom(*state));
    137138}
     
    144145    UNUSED_PARAM(thisValue);
    145146    JSTestJSBuiltinConstructor* castedThis = jsDynamicCast<JSTestJSBuiltinConstructor*>(JSValue::decode(thisValue));
    146     if (UNLIKELY(!castedThis))
     147    if (UNLIKELY(!castedThis)) {
    147148        return throwGetterTypeError(*state, "TestJSBuiltinConstructor", "testAttributeRWCustom");
     149    }
    148150    return JSValue::encode(castedThis->testAttributeRWCustom(*state));
    149151}
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r195907 r196200  
    123123    UNUSED_PARAM(thisValue);
    124124    JSTestNode* castedThis = jsDynamicCast<JSTestNode*>(JSValue::decode(thisValue));
    125     if (UNLIKELY(!castedThis))
     125    if (UNLIKELY(!castedThis)) {
    126126        return throwGetterTypeError(*state, "TestNode", "name");
     127    }
    127128    auto& impl = castedThis->wrapped();
    128129    JSValue result = jsStringWithCache(state, impl.name());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp

    r195907 r196200  
    144144    UNUSED_PARAM(thisValue);
    145145    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    146     if (UNLIKELY(!castedThis))
     146    if (UNLIKELY(!castedThis)) {
    147147        return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicReadonlyAttr");
     148    }
    148149#if ENABLE(WEB_REPLAY)
    149150    JSGlobalObject* globalObject = state->lexicalGlobalObject();
     
    178179    UNUSED_PARAM(thisValue);
    179180    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    180     if (UNLIKELY(!castedThis))
     181    if (UNLIKELY(!castedThis)) {
    181182        return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicWriteableAttr");
     183    }
    182184#if ENABLE(WEB_REPLAY)
    183185    JSGlobalObject* globalObject = state->lexicalGlobalObject();
     
    212214    UNUSED_PARAM(thisValue);
    213215    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    214     if (UNLIKELY(!castedThis))
     216    if (UNLIKELY(!castedThis)) {
    215217        return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicExceptionAttr");
     218    }
    216219#if ENABLE(WEB_REPLAY)
    217220    JSGlobalObject* globalObject = state->lexicalGlobalObject();
     
    246249    UNUSED_PARAM(thisValue);
    247250    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    248     if (UNLIKELY(!castedThis))
     251    if (UNLIKELY(!castedThis)) {
    249252        return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
     253    }
    250254    ExceptionCode ec = 0;
    251255#if ENABLE(WEB_REPLAY)
     
    284288    UNUSED_PARAM(thisValue);
    285289    JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
    286     if (UNLIKELY(!castedThis))
     290    if (UNLIKELY(!castedThis)) {
    287291        return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicSetterExceptionAttr");
     292    }
    288293#if ENABLE(WEB_REPLAY)
    289294    JSGlobalObject* globalObject = state->lexicalGlobalObject();
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r196145 r196200  
    749749    UNUSED_PARAM(thisValue);
    750750    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    751     if (UNLIKELY(!castedThis))
     751    if (UNLIKELY(!castedThis)) {
    752752        return throwGetterTypeError(*state, "TestObj", "readOnlyLongAttr");
     753    }
    753754    auto& impl = castedThis->wrapped();
    754755    JSValue result = jsNumber(impl.readOnlyLongAttr());
     
    763764    UNUSED_PARAM(thisValue);
    764765    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    765     if (UNLIKELY(!castedThis))
     766    if (UNLIKELY(!castedThis)) {
    766767        return throwGetterTypeError(*state, "TestObj", "readOnlyStringAttr");
     768    }
    767769    auto& impl = castedThis->wrapped();
    768770    JSValue result = jsStringWithCache(state, impl.readOnlyStringAttr());
     
    777779    UNUSED_PARAM(thisValue);
    778780    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    779     if (UNLIKELY(!castedThis))
     781    if (UNLIKELY(!castedThis)) {
    780782        return throwGetterTypeError(*state, "TestObj", "readOnlyTestObjAttr");
     783    }
    781784    auto& impl = castedThis->wrapped();
    782785    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.readOnlyTestObjAttr()));
     
    810813    UNUSED_PARAM(slotBase);
    811814    UNUSED_PARAM(thisValue);
    812     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    813     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    814     if (UNLIKELY(!castedThisObject))
     815    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     816    if (UNLIKELY(!castedThis)) {
    815817        return throwGetterTypeError(*state, "TestObj", "TestSubObj");
     818    }
    816819    return JSValue::encode(JSTestSubObj::getConstructor(state->vm(), castedThis->globalObject()));
    817820}
     
    823826    UNUSED_PARAM(slotBase);
    824827    UNUSED_PARAM(thisValue);
    825     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    826     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    827     if (UNLIKELY(!castedThisObject))
     828    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     829    if (UNLIKELY(!castedThis)) {
    828830        return throwGetterTypeError(*state, "TestObj", "TestSubObjEnabledBySetting");
     831    }
    829832    if (!castedThis->wrapped().frame())
    830833        return JSValue::encode(jsUndefined());
     
    842845    UNUSED_PARAM(thisValue);
    843846    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    844     if (UNLIKELY(!castedThis))
     847    if (UNLIKELY(!castedThis)) {
    845848        return throwGetterTypeError(*state, "TestObj", "enumAttr");
     849    }
    846850    auto& impl = castedThis->wrapped();
    847851    JSValue result = jsStringWithCache(state, impl.enumAttr());
     
    856860    UNUSED_PARAM(thisValue);
    857861    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    858     if (UNLIKELY(!castedThis))
     862    if (UNLIKELY(!castedThis)) {
    859863        return throwGetterTypeError(*state, "TestObj", "byteAttr");
     864    }
    860865    auto& impl = castedThis->wrapped();
    861866    JSValue result = jsNumber(impl.byteAttr());
     
    870875    UNUSED_PARAM(thisValue);
    871876    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    872     if (UNLIKELY(!castedThis))
     877    if (UNLIKELY(!castedThis)) {
    873878        return throwGetterTypeError(*state, "TestObj", "octetAttr");
     879    }
    874880    auto& impl = castedThis->wrapped();
    875881    JSValue result = jsNumber(impl.octetAttr());
     
    884890    UNUSED_PARAM(thisValue);
    885891    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    886     if (UNLIKELY(!castedThis))
     892    if (UNLIKELY(!castedThis)) {
    887893        return throwGetterTypeError(*state, "TestObj", "shortAttr");
     894    }
    888895    auto& impl = castedThis->wrapped();
    889896    JSValue result = jsNumber(impl.shortAttr());
     
    898905    UNUSED_PARAM(thisValue);
    899906    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    900     if (UNLIKELY(!castedThis))
     907    if (UNLIKELY(!castedThis)) {
    901908        return throwGetterTypeError(*state, "TestObj", "unsignedShortAttr");
     909    }
    902910    auto& impl = castedThis->wrapped();
    903911    JSValue result = jsNumber(impl.unsignedShortAttr());
     
    912920    UNUSED_PARAM(thisValue);
    913921    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    914     if (UNLIKELY(!castedThis))
     922    if (UNLIKELY(!castedThis)) {
    915923        return throwGetterTypeError(*state, "TestObj", "longAttr");
     924    }
    916925    auto& impl = castedThis->wrapped();
    917926    JSValue result = jsNumber(impl.longAttr());
     
    926935    UNUSED_PARAM(thisValue);
    927936    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    928     if (UNLIKELY(!castedThis))
     937    if (UNLIKELY(!castedThis)) {
    929938        return throwGetterTypeError(*state, "TestObj", "longLongAttr");
     939    }
    930940    auto& impl = castedThis->wrapped();
    931941    JSValue result = jsNumber(impl.longLongAttr());
     
    940950    UNUSED_PARAM(thisValue);
    941951    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    942     if (UNLIKELY(!castedThis))
     952    if (UNLIKELY(!castedThis)) {
    943953        return throwGetterTypeError(*state, "TestObj", "unsignedLongLongAttr");
     954    }
    944955    auto& impl = castedThis->wrapped();
    945956    JSValue result = jsNumber(impl.unsignedLongLongAttr());
     
    954965    UNUSED_PARAM(thisValue);
    955966    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    956     if (UNLIKELY(!castedThis))
     967    if (UNLIKELY(!castedThis)) {
    957968        return throwGetterTypeError(*state, "TestObj", "stringAttr");
     969    }
    958970    auto& impl = castedThis->wrapped();
    959971    JSValue result = jsStringWithCache(state, impl.stringAttr());
     
    968980    UNUSED_PARAM(thisValue);
    969981    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    970     if (UNLIKELY(!castedThis))
     982    if (UNLIKELY(!castedThis)) {
    971983        return throwGetterTypeError(*state, "TestObj", "testObjAttr");
     984    }
    972985    auto& impl = castedThis->wrapped();
    973986    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.testObjAttr()));
     
    982995    UNUSED_PARAM(thisValue);
    983996    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    984     if (UNLIKELY(!castedThis))
    985         return JSValue::encode(jsUndefined());
     997    if (UNLIKELY(!castedThis)) {
     998        return JSValue::encode(jsUndefined());
     999    }
    9861000    auto& impl = castedThis->wrapped();
    9871001    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.lenientTestObjAttr()));
     
    9961010    UNUSED_PARAM(thisValue);
    9971011    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    998     if (UNLIKELY(!castedThis))
     1012    if (UNLIKELY(!castedThis)) {
    9991013        return throwGetterTypeError(*state, "TestObj", "XMLObjAttr");
     1014    }
    10001015    auto& impl = castedThis->wrapped();
    10011016    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.xmlObjAttr()));
     
    10101025    UNUSED_PARAM(thisValue);
    10111026    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1012     if (UNLIKELY(!castedThis))
     1027    if (UNLIKELY(!castedThis)) {
    10131028        return throwGetterTypeError(*state, "TestObj", "create");
     1029    }
    10141030    auto& impl = castedThis->wrapped();
    10151031    JSValue result = jsBoolean(impl.isCreate());
     
    10241040    UNUSED_PARAM(thisValue);
    10251041    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1026     if (UNLIKELY(!castedThis))
     1042    if (UNLIKELY(!castedThis)) {
    10271043        return throwGetterTypeError(*state, "TestObj", "readOnlySymbolAttr");
     1044    }
    10281045    auto& impl = castedThis->wrapped();
    10291046    JSValue result = Symbol::create(state->vm(), *(impl.readOnlySymbolAttr()).uid());
     
    10481065    UNUSED_PARAM(thisValue);
    10491066    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1050     if (UNLIKELY(!castedThis))
     1067    if (UNLIKELY(!castedThis)) {
    10511068        return throwGetterTypeError(*state, "TestObj", "reflectedStringAttr");
     1069    }
    10521070    auto& impl = castedThis->wrapped();
    10531071    JSValue result = jsStringWithCache(state, impl.fastGetAttribute(WebCore::HTMLNames::reflectedstringattrAttr));
     
    10621080    UNUSED_PARAM(thisValue);
    10631081    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1064     if (UNLIKELY(!castedThis))
     1082    if (UNLIKELY(!castedThis)) {
    10651083        return throwGetterTypeError(*state, "TestObj", "reflectedIntegralAttr");
     1084    }
    10661085    auto& impl = castedThis->wrapped();
    10671086    JSValue result = jsNumber(impl.getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr));
     
    10761095    UNUSED_PARAM(thisValue);
    10771096    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1078     if (UNLIKELY(!castedThis))
     1097    if (UNLIKELY(!castedThis)) {
    10791098        return throwGetterTypeError(*state, "TestObj", "reflectedUnsignedIntegralAttr");
     1099    }
    10801100    auto& impl = castedThis->wrapped();
    10811101    JSValue result = jsNumber(std::max(0, impl.getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)));
     
    10901110    UNUSED_PARAM(thisValue);
    10911111    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1092     if (UNLIKELY(!castedThis))
     1112    if (UNLIKELY(!castedThis)) {
    10931113        return throwGetterTypeError(*state, "TestObj", "reflectedBooleanAttr");
     1114    }
    10941115    auto& impl = castedThis->wrapped();
    10951116    JSValue result = jsBoolean(impl.fastHasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr));
     
    11041125    UNUSED_PARAM(thisValue);
    11051126    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1106     if (UNLIKELY(!castedThis))
     1127    if (UNLIKELY(!castedThis)) {
    11071128        return throwGetterTypeError(*state, "TestObj", "reflectedURLAttr");
     1129    }
    11081130    auto& impl = castedThis->wrapped();
    11091131    JSValue result = jsStringWithCache(state, impl.getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr));
     
    11181140    UNUSED_PARAM(thisValue);
    11191141    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1120     if (UNLIKELY(!castedThis))
     1142    if (UNLIKELY(!castedThis)) {
    11211143        return throwGetterTypeError(*state, "TestObj", "reflectedStringAttr");
     1144    }
    11221145    auto& impl = castedThis->wrapped();
    11231146    JSValue result = jsStringWithCache(state, impl.fastGetAttribute(WebCore::HTMLNames::customContentStringAttrAttr));
     
    11321155    UNUSED_PARAM(thisValue);
    11331156    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1134     if (UNLIKELY(!castedThis))
     1157    if (UNLIKELY(!castedThis)) {
    11351158        return throwGetterTypeError(*state, "TestObj", "reflectedCustomIntegralAttr");
     1159    }
    11361160    auto& impl = castedThis->wrapped();
    11371161    JSValue result = jsNumber(impl.getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr));
     
    11461170    UNUSED_PARAM(thisValue);
    11471171    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1148     if (UNLIKELY(!castedThis))
     1172    if (UNLIKELY(!castedThis)) {
    11491173        return throwGetterTypeError(*state, "TestObj", "reflectedCustomBooleanAttr");
     1174    }
    11501175    auto& impl = castedThis->wrapped();
    11511176    JSValue result = jsBoolean(impl.fastHasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr));
     
    11601185    UNUSED_PARAM(thisValue);
    11611186    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1162     if (UNLIKELY(!castedThis))
     1187    if (UNLIKELY(!castedThis)) {
    11631188        return throwGetterTypeError(*state, "TestObj", "reflectedCustomURLAttr");
     1189    }
    11641190    auto& impl = castedThis->wrapped();
    11651191    JSValue result = jsStringWithCache(state, impl.getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr));
     
    11741200    UNUSED_PARAM(thisValue);
    11751201    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1176     if (UNLIKELY(!castedThis))
     1202    if (UNLIKELY(!castedThis)) {
    11771203        return throwGetterTypeError(*state, "TestObj", "typedArrayAttr");
     1204    }
    11781205    auto& impl = castedThis->wrapped();
    11791206    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.typedArrayAttr()));
     
    11881215    UNUSED_PARAM(thisValue);
    11891216    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1190     if (UNLIKELY(!castedThis))
     1217    if (UNLIKELY(!castedThis)) {
    11911218        return throwGetterTypeError(*state, "TestObj", "attrWithGetterException");
     1219    }
    11921220    ExceptionCode ec = 0;
    11931221    auto& impl = castedThis->wrapped();
     
    12041232    UNUSED_PARAM(thisValue);
    12051233    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1206     if (UNLIKELY(!castedThis))
     1234    if (UNLIKELY(!castedThis)) {
    12071235        return throwGetterTypeError(*state, "TestObj", "attrWithGetterExceptionWithMessage");
     1236    }
    12081237    ExceptionCodeWithMessage ec;
    12091238    auto& impl = castedThis->wrapped();
     
    12201249    UNUSED_PARAM(thisValue);
    12211250    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1222     if (UNLIKELY(!castedThis))
     1251    if (UNLIKELY(!castedThis)) {
    12231252        return throwGetterTypeError(*state, "TestObj", "attrWithSetterException");
     1253    }
    12241254    auto& impl = castedThis->wrapped();
    12251255    JSValue result = jsNumber(impl.attrWithSetterException());
     
    12341264    UNUSED_PARAM(thisValue);
    12351265    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1236     if (UNLIKELY(!castedThis))
     1266    if (UNLIKELY(!castedThis)) {
    12371267        return throwGetterTypeError(*state, "TestObj", "attrWithSetterExceptionWithMessage");
     1268    }
    12381269    auto& impl = castedThis->wrapped();
    12391270    JSValue result = jsNumber(impl.attrWithSetterExceptionWithMessage());
     
    12481279    UNUSED_PARAM(thisValue);
    12491280    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1250     if (UNLIKELY(!castedThis))
     1281    if (UNLIKELY(!castedThis)) {
    12511282        return throwGetterTypeError(*state, "TestObj", "stringAttrWithGetterException");
     1283    }
    12521284    ExceptionCode ec = 0;
    12531285    auto& impl = castedThis->wrapped();
     
    12641296    UNUSED_PARAM(thisValue);
    12651297    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1266     if (UNLIKELY(!castedThis))
     1298    if (UNLIKELY(!castedThis)) {
    12671299        return throwGetterTypeError(*state, "TestObj", "stringAttrWithSetterException");
     1300    }
    12681301    auto& impl = castedThis->wrapped();
    12691302    JSValue result = jsStringWithCache(state, impl.stringAttrWithSetterException());
     
    12781311    UNUSED_PARAM(thisValue);
    12791312    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1280     if (UNLIKELY(!castedThis))
     1313    if (UNLIKELY(!castedThis)) {
    12811314        return throwGetterTypeError(*state, "TestObj", "strictTypeCheckingAttribute");
     1315    }
    12821316    auto& impl = castedThis->wrapped();
    12831317    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.strictTypeCheckingAttribute()));
     
    12921326    UNUSED_PARAM(thisValue);
    12931327    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1294     if (UNLIKELY(!castedThis))
     1328    if (UNLIKELY(!castedThis)) {
    12951329        return throwGetterTypeError(*state, "TestObj", "customAttr");
     1330    }
    12961331    return JSValue::encode(castedThis->customAttr(*state));
    12971332}
     
    13041339    UNUSED_PARAM(thisValue);
    13051340    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1306     if (UNLIKELY(!castedThis))
     1341    if (UNLIKELY(!castedThis)) {
    13071342        return throwGetterTypeError(*state, "TestObj", "onfoo");
     1343    }
    13081344    UNUSED_PARAM(state);
    13091345    return JSValue::encode(eventHandlerAttribute(castedThis->wrapped(), eventNames().fooEvent));
     
    13171353    UNUSED_PARAM(thisValue);
    13181354    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1319     if (UNLIKELY(!castedThis))
     1355    if (UNLIKELY(!castedThis)) {
    13201356        return throwGetterTypeError(*state, "TestObj", "withScriptStateAttribute");
     1357    }
    13211358    auto& impl = castedThis->wrapped();
    13221359    JSValue result = jsNumber(impl.withScriptStateAttribute(*state));
     
    13311368    UNUSED_PARAM(thisValue);
    13321369    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1333     if (UNLIKELY(!castedThis))
     1370    if (UNLIKELY(!castedThis)) {
    13341371        return throwGetterTypeError(*state, "TestObj", "withCallWithAndSetterCallWithAttribute");
     1372    }
    13351373    auto& impl = castedThis->wrapped();
    13361374    JSValue result = jsNumber(impl.withCallWithAndSetterCallWithAttribute(*state));
     
    13451383    UNUSED_PARAM(thisValue);
    13461384    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1347     if (UNLIKELY(!castedThis))
     1385    if (UNLIKELY(!castedThis)) {
    13481386        return throwGetterTypeError(*state, "TestObj", "withScriptExecutionContextAttribute");
     1387    }
    13491388    auto* scriptContext = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
    13501389    if (!scriptContext)
     
    13621401    UNUSED_PARAM(thisValue);
    13631402    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1364     if (UNLIKELY(!castedThis))
     1403    if (UNLIKELY(!castedThis)) {
    13651404        return throwGetterTypeError(*state, "TestObj", "withScriptStateAttributeRaises");
     1405    }
    13661406    ExceptionCode ec = 0;
    13671407    auto& impl = castedThis->wrapped();
     
    13781418    UNUSED_PARAM(thisValue);
    13791419    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1380     if (UNLIKELY(!castedThis))
     1420    if (UNLIKELY(!castedThis)) {
    13811421        return throwGetterTypeError(*state, "TestObj", "withScriptExecutionContextAttributeRaises");
     1422    }
    13821423    ExceptionCode ec = 0;
    13831424    auto* scriptContext = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     
    13971438    UNUSED_PARAM(thisValue);
    13981439    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1399     if (UNLIKELY(!castedThis))
     1440    if (UNLIKELY(!castedThis)) {
    14001441        return throwGetterTypeError(*state, "TestObj", "withScriptExecutionContextAndScriptStateAttribute");
     1442    }
    14011443    auto* scriptContext = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
    14021444    if (!scriptContext)
     
    14141456    UNUSED_PARAM(thisValue);
    14151457    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1416     if (UNLIKELY(!castedThis))
     1458    if (UNLIKELY(!castedThis)) {
    14171459        return throwGetterTypeError(*state, "TestObj", "withScriptExecutionContextAndScriptStateAttributeRaises");
     1460    }
    14181461    ExceptionCode ec = 0;
    14191462    auto* scriptContext = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
     
    14331476    UNUSED_PARAM(thisValue);
    14341477    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1435     if (UNLIKELY(!castedThis))
     1478    if (UNLIKELY(!castedThis)) {
    14361479        return throwGetterTypeError(*state, "TestObj", "withScriptExecutionContextAndScriptStateWithSpacesAttribute");
     1480    }
    14371481    auto* scriptContext = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
    14381482    if (!scriptContext)
     
    14501494    UNUSED_PARAM(thisValue);
    14511495    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1452     if (UNLIKELY(!castedThis))
     1496    if (UNLIKELY(!castedThis)) {
    14531497        return throwGetterTypeError(*state, "TestObj", "withScriptArgumentsAndCallStackAttribute");
     1498    }
    14541499    auto& impl = castedThis->wrapped();
    14551500    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.withScriptArgumentsAndCallStackAttribute()));
     
    14651510    UNUSED_PARAM(thisValue);
    14661511    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1467     if (UNLIKELY(!castedThis))
     1512    if (UNLIKELY(!castedThis)) {
    14681513        return throwGetterTypeError(*state, "TestObj", "conditionalAttr1");
     1514    }
    14691515    auto& impl = castedThis->wrapped();
    14701516    JSValue result = jsNumber(impl.conditionalAttr1());
     
    14811527    UNUSED_PARAM(thisValue);
    14821528    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1483     if (UNLIKELY(!castedThis))
     1529    if (UNLIKELY(!castedThis)) {
    14841530        return throwGetterTypeError(*state, "TestObj", "conditionalAttr2");
     1531    }
    14851532    auto& impl = castedThis->wrapped();
    14861533    JSValue result = jsNumber(impl.conditionalAttr2());
     
    14971544    UNUSED_PARAM(thisValue);
    14981545    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1499     if (UNLIKELY(!castedThis))
     1546    if (UNLIKELY(!castedThis)) {
    15001547        return throwGetterTypeError(*state, "TestObj", "conditionalAttr3");
     1548    }
    15011549    auto& impl = castedThis->wrapped();
    15021550    JSValue result = jsNumber(impl.conditionalAttr3());
     
    15121560    UNUSED_PARAM(slotBase);
    15131561    UNUSED_PARAM(thisValue);
    1514     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    1515     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1516     if (UNLIKELY(!castedThisObject))
     1562    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     1563    if (UNLIKELY(!castedThis)) {
    15171564        return throwGetterTypeError(*state, "TestObj", "conditionalAttr4");
     1565    }
    15181566    return JSValue::encode(JSTestObjectA::getConstructor(state->vm(), castedThis->globalObject()));
    15191567}
     
    15271575    UNUSED_PARAM(slotBase);
    15281576    UNUSED_PARAM(thisValue);
    1529     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    1530     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1531     if (UNLIKELY(!castedThisObject))
     1577    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     1578    if (UNLIKELY(!castedThis)) {
    15321579        return throwGetterTypeError(*state, "TestObj", "conditionalAttr5");
     1580    }
    15331581    return JSValue::encode(JSTestObjectB::getConstructor(state->vm(), castedThis->globalObject()));
    15341582}
     
    15421590    UNUSED_PARAM(slotBase);
    15431591    UNUSED_PARAM(thisValue);
    1544     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    1545     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1546     if (UNLIKELY(!castedThisObject))
     1592    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     1593    if (UNLIKELY(!castedThis)) {
    15471594        return throwGetterTypeError(*state, "TestObj", "conditionalAttr6");
     1595    }
    15481596    return JSValue::encode(JSTestObjectC::getConstructor(state->vm(), castedThis->globalObject()));
    15491597}
     
    15571605    UNUSED_PARAM(thisValue);
    15581606    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1559     if (UNLIKELY(!castedThis))
     1607    if (UNLIKELY(!castedThis)) {
    15601608        return throwGetterTypeError(*state, "TestObj", "cachedAttribute1");
     1609    }
    15611610    if (JSValue cachedValue = castedThis->m_cachedAttribute1.get())
    15621611        return JSValue::encode(cachedValue);
     
    15741623    UNUSED_PARAM(thisValue);
    15751624    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1576     if (UNLIKELY(!castedThis))
     1625    if (UNLIKELY(!castedThis)) {
    15771626        return throwGetterTypeError(*state, "TestObj", "cachedAttribute2");
     1627    }
    15781628    if (JSValue cachedValue = castedThis->m_cachedAttribute2.get())
    15791629        return JSValue::encode(cachedValue);
     
    15911641    UNUSED_PARAM(thisValue);
    15921642    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1593     if (UNLIKELY(!castedThis))
     1643    if (UNLIKELY(!castedThis)) {
    15941644        return throwGetterTypeError(*state, "TestObj", "anyAttribute");
     1645    }
    15951646    auto& impl = castedThis->wrapped();
    15961647    JSValue result = (impl.anyAttribute().hasNoValue() ? jsNull() : impl.anyAttribute().jsValue());
     
    16041655    UNUSED_PARAM(slotBase);
    16051656    UNUSED_PARAM(thisValue);
    1606     auto* castedThis = jsCast<JSTestObj*>(slotBase);
    1607     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1608     if (UNLIKELY(!castedThisObject))
     1657    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     1658    if (UNLIKELY(!castedThis)) {
    16091659        return throwGetterTypeError(*state, "TestObj", "contentDocument");
     1660    }
    16101661    auto& impl = castedThis->wrapped();
    16111662    return JSValue::encode(shouldAllowAccessToNode(state, impl.contentDocument()) ? toJS(state, castedThis->globalObject(), WTF::getPtr(impl.contentDocument())) : jsNull());
     
    16191670    UNUSED_PARAM(thisValue);
    16201671    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1621     if (UNLIKELY(!castedThis))
     1672    if (UNLIKELY(!castedThis)) {
    16221673        return throwGetterTypeError(*state, "TestObj", "mutablePoint");
     1674    }
    16231675    auto& impl = castedThis->wrapped();
    16241676    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(SVGStaticPropertyTearOff<TestObj, SVGPoint>::create(impl, impl.mutablePoint(), &TestObj::updateMutablePoint)));
     
    16331685    UNUSED_PARAM(thisValue);
    16341686    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1635     if (UNLIKELY(!castedThis))
     1687    if (UNLIKELY(!castedThis)) {
    16361688        return throwGetterTypeError(*state, "TestObj", "immutablePoint");
     1689    }
    16371690    auto& impl = castedThis->wrapped();
    16381691    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePoint())));
     
    16471700    UNUSED_PARAM(thisValue);
    16481701    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1649     if (UNLIKELY(!castedThis))
     1702    if (UNLIKELY(!castedThis)) {
    16501703        return throwGetterTypeError(*state, "TestObj", "strawberry");
     1704    }
    16511705    auto& impl = castedThis->wrapped();
    16521706    JSValue result = jsNumber(impl.blueberry());
     
    16611715    UNUSED_PARAM(thisValue);
    16621716    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1663     if (UNLIKELY(!castedThis))
     1717    if (UNLIKELY(!castedThis)) {
    16641718        return throwGetterTypeError(*state, "TestObj", "strictFloat");
     1719    }
    16651720    auto& impl = castedThis->wrapped();
    16661721    JSValue result = jsNumber(impl.strictFloat());
     
    16751730    UNUSED_PARAM(thisValue);
    16761731    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1677     if (UNLIKELY(!castedThis))
     1732    if (UNLIKELY(!castedThis)) {
    16781733        return throwGetterTypeError(*state, "TestObj", "description");
     1734    }
    16791735    auto& impl = castedThis->wrapped();
    16801736    JSValue result = jsNumber(impl.description());
     
    16891745    UNUSED_PARAM(thisValue);
    16901746    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1691     if (UNLIKELY(!castedThis))
     1747    if (UNLIKELY(!castedThis)) {
    16921748        return throwGetterTypeError(*state, "TestObj", "id");
     1749    }
    16931750    auto& impl = castedThis->wrapped();
    16941751    JSValue result = jsNumber(impl.id());
     
    17031760    UNUSED_PARAM(thisValue);
    17041761    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1705     if (UNLIKELY(!castedThis))
     1762    if (UNLIKELY(!castedThis)) {
    17061763        return throwGetterTypeError(*state, "TestObj", "hash");
     1764    }
    17071765    auto& impl = castedThis->wrapped();
    17081766    JSValue result = jsStringWithCache(state, impl.hash());
     
    17171775    UNUSED_PARAM(thisValue);
    17181776    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1719     if (UNLIKELY(!castedThis))
     1777    if (UNLIKELY(!castedThis)) {
    17201778        return throwGetterTypeError(*state, "TestObj", "replaceableAttribute");
     1779    }
    17211780    auto& impl = castedThis->wrapped();
    17221781    JSValue result = jsNumber(impl.replaceableAttribute());
     
    17311790    UNUSED_PARAM(thisValue);
    17321791    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1733     if (UNLIKELY(!castedThis))
     1792    if (UNLIKELY(!castedThis)) {
    17341793        return throwGetterTypeError(*state, "TestObj", "nullableDoubleAttribute");
     1794    }
    17351795    auto& impl = castedThis->wrapped();
    17361796    JSValue result = toNullableJSNumber(impl.nullableDoubleAttribute());
     
    17451805    UNUSED_PARAM(thisValue);
    17461806    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1747     if (UNLIKELY(!castedThis))
     1807    if (UNLIKELY(!castedThis)) {
    17481808        return throwGetterTypeError(*state, "TestObj", "nullableLongAttribute");
     1809    }
    17491810    auto& impl = castedThis->wrapped();
    17501811    JSValue result = toNullableJSNumber(impl.nullableLongAttribute());
     
    17591820    UNUSED_PARAM(thisValue);
    17601821    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1761     if (UNLIKELY(!castedThis))
     1822    if (UNLIKELY(!castedThis)) {
    17621823        return throwGetterTypeError(*state, "TestObj", "nullableBooleanAttribute");
     1824    }
    17631825    auto& impl = castedThis->wrapped();
    17641826    JSValue result = jsBoolean(impl.nullableBooleanAttribute());
     
    17731835    UNUSED_PARAM(thisValue);
    17741836    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1775     if (UNLIKELY(!castedThis))
     1837    if (UNLIKELY(!castedThis)) {
    17761838        return throwGetterTypeError(*state, "TestObj", "nullableStringAttribute");
     1839    }
    17771840    auto& impl = castedThis->wrapped();
    17781841    JSValue result = jsStringWithCache(state, impl.nullableStringAttribute());
     
    17871850    UNUSED_PARAM(thisValue);
    17881851    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1789     if (UNLIKELY(!castedThis))
     1852    if (UNLIKELY(!castedThis)) {
    17901853        return throwGetterTypeError(*state, "TestObj", "nullableLongSettableAttribute");
     1854    }
    17911855    auto& impl = castedThis->wrapped();
    17921856    JSValue result = toNullableJSNumber(impl.nullableLongSettableAttribute());
     
    18011865    UNUSED_PARAM(thisValue);
    18021866    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1803     if (UNLIKELY(!castedThis))
     1867    if (UNLIKELY(!castedThis)) {
    18041868        return throwGetterTypeError(*state, "TestObj", "nullableStringValue");
     1869    }
    18051870    ExceptionCode ec = 0;
    18061871    auto& impl = castedThis->wrapped();
     
    18171882    UNUSED_PARAM(thisValue);
    18181883    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1819     if (UNLIKELY(!castedThis))
     1884    if (UNLIKELY(!castedThis)) {
    18201885        return throwGetterTypeError(*state, "TestObj", "attribute");
     1886    }
    18211887    auto& impl = castedThis->wrapped();
    18221888    JSValue result = jsStringWithCache(state, impl.attribute());
     
    18311897    UNUSED_PARAM(thisValue);
    18321898    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1833     if (UNLIKELY(!castedThis))
     1899    if (UNLIKELY(!castedThis)) {
    18341900        return throwGetterTypeError(*state, "TestObj", "attributeWithReservedEnumType");
     1901    }
    18351902    auto& impl = castedThis->wrapped();
    18361903    JSValue result = jsStringWithCache(state, impl.attributeWithReservedEnumType());
     
    18451912    UNUSED_PARAM(thisValue);
    18461913    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1847     if (UNLIKELY(!castedThis))
     1914    if (UNLIKELY(!castedThis)) {
    18481915        return throwGetterTypeError(*state, "TestObj", "putForwardsAttribute");
     1916    }
    18491917    auto& impl = castedThis->wrapped();
    18501918    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.putForwardsAttribute()));
     
    18591927    UNUSED_PARAM(thisValue);
    18601928    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1861     if (UNLIKELY(!castedThis))
     1929    if (UNLIKELY(!castedThis)) {
    18621930        return throwGetterTypeError(*state, "TestObj", "putForwardsNullableAttribute");
     1931    }
    18631932    auto& impl = castedThis->wrapped();
    18641933    JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.putForwardsNullableAttribute()));
     
    19031972    JSValue value = JSValue::decode(encodedValue);
    19041973    UNUSED_PARAM(baseObject);
    1905     auto* castedThis = jsCast<JSTestObj*>(baseObject);
    1906     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    1907     if (UNLIKELY(!castedThisObject)) {
     1974    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     1975    if (UNLIKELY(!castedThis)) {
    19081976        throwSetterTypeError(*state, "TestObj", "TestSubObjEnabledBySetting");
    19091977        return;
     
    26912759    JSValue value = JSValue::decode(encodedValue);
    26922760    UNUSED_PARAM(baseObject);
    2693     auto* castedThis = jsCast<JSTestObj*>(baseObject);
    2694     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    2695     if (UNLIKELY(!castedThisObject)) {
     2761    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     2762    if (UNLIKELY(!castedThis)) {
    26962763        throwSetterTypeError(*state, "TestObj", "conditionalAttr4");
    26972764        return;
     
    27082775    JSValue value = JSValue::decode(encodedValue);
    27092776    UNUSED_PARAM(baseObject);
    2710     auto* castedThis = jsCast<JSTestObj*>(baseObject);
    2711     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    2712     if (UNLIKELY(!castedThisObject)) {
     2777    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     2778    if (UNLIKELY(!castedThis)) {
    27132779        throwSetterTypeError(*state, "TestObj", "conditionalAttr5");
    27142780        return;
     
    27252791    JSValue value = JSValue::decode(encodedValue);
    27262792    UNUSED_PARAM(baseObject);
    2727     auto* castedThis = jsCast<JSTestObj*>(baseObject);
    2728     JSTestObj* castedThisObject = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
    2729     if (UNLIKELY(!castedThisObject)) {
     2793    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
     2794    if (UNLIKELY(!castedThis)) {
    27302795        throwSetterTypeError(*state, "TestObj", "conditionalAttr6");
    27312796        return;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r195907 r196200  
    134134    UNUSED_PARAM(thisValue);
    135135    JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue));
    136     if (UNLIKELY(!castedThis))
     136    if (UNLIKELY(!castedThis)) {
    137137        return throwGetterTypeError(*state, "TestSerializedScriptValueInterface", "value");
     138    }
    138139    auto& impl = castedThis->wrapped();
    139140    JSValue result = impl.value() ? impl.value()->deserialize(state, castedThis->globalObject(), 0) : jsNull();
     
    148149    UNUSED_PARAM(thisValue);
    149150    JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue));
    150     if (UNLIKELY(!castedThis))
     151    if (UNLIKELY(!castedThis)) {
    151152        return throwGetterTypeError(*state, "TestSerializedScriptValueInterface", "readonlyValue");
     153    }
    152154    auto& impl = castedThis->wrapped();
    153155    JSValue result = impl.readonlyValue() ? impl.readonlyValue()->deserialize(state, castedThis->globalObject(), 0) : jsNull();
     
    162164    UNUSED_PARAM(thisValue);
    163165    JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue));
    164     if (UNLIKELY(!castedThis))
     166    if (UNLIKELY(!castedThis)) {
    165167        return throwGetterTypeError(*state, "TestSerializedScriptValueInterface", "cachedValue");
     168    }
    166169    if (JSValue cachedValue = castedThis->m_cachedValue.get())
    167170        return JSValue::encode(cachedValue);
     
    179182    UNUSED_PARAM(thisValue);
    180183    JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue));
    181     if (UNLIKELY(!castedThis))
     184    if (UNLIKELY(!castedThis)) {
    182185        return throwGetterTypeError(*state, "TestSerializedScriptValueInterface", "ports");
     186    }
    183187    auto& impl = castedThis->wrapped();
    184188    JSValue result = jsArray(state, castedThis->globalObject(), impl.ports());
     
    193197    UNUSED_PARAM(thisValue);
    194198    JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast<JSTestSerializedScriptValueInterface*>(JSValue::decode(thisValue));
    195     if (UNLIKELY(!castedThis))
     199    if (UNLIKELY(!castedThis)) {
    196200        return throwGetterTypeError(*state, "TestSerializedScriptValueInterface", "cachedReadonlyValue");
     201    }
    197202    if (JSValue cachedValue = castedThis->m_cachedReadonlyValue.get())
    198203        return JSValue::encode(cachedValue);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r196145 r196200  
    217217    UNUSED_PARAM(thisValue);
    218218    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    219     if (UNLIKELY(!castedThis))
     219    if (UNLIKELY(!castedThis)) {
    220220        return throwGetterTypeError(*state, "TestTypedefs", "unsignedLongLongAttr");
     221    }
    221222    auto& impl = castedThis->wrapped();
    222223    JSValue result = jsNumber(impl.unsignedLongLongAttr());
     
    231232    UNUSED_PARAM(thisValue);
    232233    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    233     if (UNLIKELY(!castedThis))
     234    if (UNLIKELY(!castedThis)) {
    234235        return throwGetterTypeError(*state, "TestTypedefs", "immutableSerializedScriptValue");
     236    }
    235237    auto& impl = castedThis->wrapped();
    236238    JSValue result = impl.immutableSerializedScriptValue() ? impl.immutableSerializedScriptValue()->deserialize(state, castedThis->globalObject(), 0) : jsNull();
     
    244246    UNUSED_PARAM(slotBase);
    245247    UNUSED_PARAM(thisValue);
    246     auto* castedThis = jsCast<JSTestTypedefs*>(slotBase);
    247     JSTestTypedefs* castedThisObject = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    248     if (UNLIKELY(!castedThisObject))
     248    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
     249    if (UNLIKELY(!castedThis)) {
    249250        return throwGetterTypeError(*state, "TestTypedefs", "TestSubObj");
     251    }
    250252    return JSValue::encode(JSTestSubObj::getConstructor(state->vm(), castedThis->globalObject()));
    251253}
     
    258260    UNUSED_PARAM(thisValue);
    259261    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    260     if (UNLIKELY(!castedThis))
     262    if (UNLIKELY(!castedThis)) {
    261263        return throwGetterTypeError(*state, "TestTypedefs", "attrWithGetterException");
     264    }
    262265    ExceptionCode ec = 0;
    263266    auto& impl = castedThis->wrapped();
     
    274277    UNUSED_PARAM(thisValue);
    275278    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    276     if (UNLIKELY(!castedThis))
     279    if (UNLIKELY(!castedThis)) {
    277280        return throwGetterTypeError(*state, "TestTypedefs", "attrWithSetterException");
     281    }
    278282    auto& impl = castedThis->wrapped();
    279283    JSValue result = jsNumber(impl.attrWithSetterException());
     
    288292    UNUSED_PARAM(thisValue);
    289293    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    290     if (UNLIKELY(!castedThis))
     294    if (UNLIKELY(!castedThis)) {
    291295        return throwGetterTypeError(*state, "TestTypedefs", "stringAttrWithGetterException");
     296    }
    292297    ExceptionCode ec = 0;
    293298    auto& impl = castedThis->wrapped();
     
    304309    UNUSED_PARAM(thisValue);
    305310    JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
    306     if (UNLIKELY(!castedThis))
     311    if (UNLIKELY(!castedThis)) {
    307312        return throwGetterTypeError(*state, "TestTypedefs", "stringAttrWithSetterException");
     313    }
    308314    auto& impl = castedThis->wrapped();
    309315    JSValue result = jsStringWithCache(state, impl.stringAttrWithSetterException());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp

    r195907 r196200  
    119119    UNUSED_PARAM(thisValue);
    120120    JSattribute* castedThis = jsDynamicCast<JSattribute*>(JSValue::decode(thisValue));
    121     if (UNLIKELY(!castedThis))
     121    if (UNLIKELY(!castedThis)) {
    122122        return throwGetterTypeError(*state, "attribute", "readonly");
     123    }
    123124    auto& impl = castedThis->wrapped();
    124125    JSValue result = jsStringWithCache(state, impl.readonly());
Note: See TracChangeset for help on using the changeset viewer.