Changeset 147038 in webkit


Ignore:
Timestamp:
Mar 27, 2013 5:41:19 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

javascriptcore bindings do not check exception after calling valueToStringWithNullCheck
https://bugs.webkit.org/show_bug.cgi?id=113219

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2013-03-27
Reviewed by Kentaro Hara.

Source/WebCore:

When converting JSValue to native value in attribute setter, store the
native value in a temporary variable. After this variable assignment,
always check if an exception has been raised.

Update binding tests.

Test: fast/dom/exception-in-binding.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):
(GetNativeType):
(JSValueToNative):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
(WebCore::setJSTestInterfaceSupplementalStr2):
(WebCore::setJSTestInterfaceSupplementalNode):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::setJSTestObjConstructorStaticStringAttr):
(WebCore::setJSTestObjEnumAttr):
(WebCore::setJSTestObjShortAttr):
(WebCore::setJSTestObjUnsignedShortAttr):
(WebCore::setJSTestObjLongAttr):
(WebCore::setJSTestObjLongLongAttr):
(WebCore::setJSTestObjUnsignedLongLongAttr):
(WebCore::setJSTestObjStringAttr):
(WebCore::setJSTestObjTestObjAttr):
(WebCore::setJSTestObjXMLObjAttr):
(WebCore::setJSTestObjCreate):
(WebCore::setJSTestObjReflectedStringAttr):
(WebCore::setJSTestObjReflectedIntegralAttr):
(WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
(WebCore::setJSTestObjReflectedBooleanAttr):
(WebCore::setJSTestObjReflectedURLAttr):
(WebCore::setJSTestObjReflectedCustomIntegralAttr):
(WebCore::setJSTestObjReflectedCustomBooleanAttr):
(WebCore::setJSTestObjReflectedCustomURLAttr):
(WebCore::setJSTestObjTypedArrayAttr):
(WebCore::setJSTestObjAttrWithGetterException):
(WebCore::setJSTestObjAttrWithSetterException):
(WebCore::setJSTestObjStringAttrWithGetterException):
(WebCore::setJSTestObjStringAttrWithSetterException):
(WebCore::setJSTestObjWithScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::setJSTestObjConditionalAttr1):
(WebCore::setJSTestObjConditionalAttr2):
(WebCore::setJSTestObjConditionalAttr3):
(WebCore::setJSTestObjAnyAttribute):
(WebCore::setJSTestObjMutablePoint):
(WebCore::setJSTestObjImmutablePoint):
(WebCore::setJSTestObjStrawberry):
(WebCore::setJSTestObjStrictFloat):
(WebCore::setJSTestObjId):
(WebCore::setJSTestObjNullableLongSettableAttribute):
(WebCore::setJSTestObjNullableStringValue):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::setJSTestSerializedScriptValueInterfaceValue):
(WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):

  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::setJSTestTypedefsUnsignedLongLongAttr):
(WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
(WebCore::setJSTestTypedefsAttrWithGetterException):
(WebCore::setJSTestTypedefsAttrWithSetterException):
(WebCore::setJSTestTypedefsStringAttrWithGetterException):
(WebCore::setJSTestTypedefsStringAttrWithSetterException):

LayoutTests:

  • fast/dom/exception-in-binding-expected.txt: Added.
  • fast/dom/exception-in-binding.html: Added.
  • platform/chromium/TestExpectations: new test fails for now
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r147036 r147038  
     12013-03-27  Arnaud Renevier  <a.renevier@sisa.samsung.com>
     2
     3        javascriptcore bindings do not check exception after calling valueToStringWithNullCheck
     4        https://bugs.webkit.org/show_bug.cgi?id=113219
     5
     6        Reviewed by Kentaro Hara.
     7
     8        * fast/dom/exception-in-binding-expected.txt: Added.
     9        * fast/dom/exception-in-binding.html: Added.
     10        * platform/chromium/TestExpectations: new test fails for now
     11
    1122013-03-27  Claudio Saavedra  <csaavedra@igalia.com>
    213
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r147022 r147038  
    37993799
    38003800webkit.org/b/113114 media/video-controls-captions.html [ Timeout ]
     3801
     3802webkit.org/b/113219 fast/dom/exception-in-binding.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r147037 r147038  
     12013-03-27  Arnaud Renevier  <a.renevier@sisa.samsung.com>
     2
     3        javascriptcore bindings do not check exception after calling valueToStringWithNullCheck
     4        https://bugs.webkit.org/show_bug.cgi?id=113219
     5
     6        Reviewed by Kentaro Hara.
     7
     8        When converting JSValue to native value in attribute setter, store the
     9        native value in a temporary variable. After this variable assignment,
     10        always check if an exception has been raised.
     11
     12        Update binding tests.
     13
     14        Test: fast/dom/exception-in-binding.html
     15
     16        * bindings/scripts/CodeGeneratorJS.pm:
     17        (GenerateImplementation):
     18        (GetNativeType):
     19        (JSValueToNative):
     20        * bindings/scripts/test/JS/JSTestInterface.cpp:
     21        (WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
     22        (WebCore::setJSTestInterfaceSupplementalStr2):
     23        (WebCore::setJSTestInterfaceSupplementalNode):
     24        * bindings/scripts/test/JS/JSTestObj.cpp:
     25        (WebCore::setJSTestObjConstructorStaticStringAttr):
     26        (WebCore::setJSTestObjEnumAttr):
     27        (WebCore::setJSTestObjShortAttr):
     28        (WebCore::setJSTestObjUnsignedShortAttr):
     29        (WebCore::setJSTestObjLongAttr):
     30        (WebCore::setJSTestObjLongLongAttr):
     31        (WebCore::setJSTestObjUnsignedLongLongAttr):
     32        (WebCore::setJSTestObjStringAttr):
     33        (WebCore::setJSTestObjTestObjAttr):
     34        (WebCore::setJSTestObjXMLObjAttr):
     35        (WebCore::setJSTestObjCreate):
     36        (WebCore::setJSTestObjReflectedStringAttr):
     37        (WebCore::setJSTestObjReflectedIntegralAttr):
     38        (WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
     39        (WebCore::setJSTestObjReflectedBooleanAttr):
     40        (WebCore::setJSTestObjReflectedURLAttr):
     41        (WebCore::setJSTestObjReflectedCustomIntegralAttr):
     42        (WebCore::setJSTestObjReflectedCustomBooleanAttr):
     43        (WebCore::setJSTestObjReflectedCustomURLAttr):
     44        (WebCore::setJSTestObjTypedArrayAttr):
     45        (WebCore::setJSTestObjAttrWithGetterException):
     46        (WebCore::setJSTestObjAttrWithSetterException):
     47        (WebCore::setJSTestObjStringAttrWithGetterException):
     48        (WebCore::setJSTestObjStringAttrWithSetterException):
     49        (WebCore::setJSTestObjWithScriptStateAttribute):
     50        (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
     51        (WebCore::setJSTestObjWithScriptStateAttributeRaises):
     52        (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
     53        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
     54        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
     55        (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
     56        (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
     57        (WebCore::setJSTestObjConditionalAttr1):
     58        (WebCore::setJSTestObjConditionalAttr2):
     59        (WebCore::setJSTestObjConditionalAttr3):
     60        (WebCore::setJSTestObjAnyAttribute):
     61        (WebCore::setJSTestObjMutablePoint):
     62        (WebCore::setJSTestObjImmutablePoint):
     63        (WebCore::setJSTestObjStrawberry):
     64        (WebCore::setJSTestObjStrictFloat):
     65        (WebCore::setJSTestObjId):
     66        (WebCore::setJSTestObjNullableLongSettableAttribute):
     67        (WebCore::setJSTestObjNullableStringValue):
     68        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     69        (WebCore::setJSTestSerializedScriptValueInterfaceValue):
     70        (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
     71        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     72        (WebCore::setJSTestTypedefsUnsignedLongLongAttr):
     73        (WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
     74        (WebCore::setJSTestTypedefsAttrWithGetterException):
     75        (WebCore::setJSTestTypedefsAttrWithSetterException):
     76        (WebCore::setJSTestTypedefsStringAttrWithGetterException):
     77        (WebCore::setJSTestTypedefsStringAttrWithSetterException):
     78
    1792013-03-27  Arnaud Renevier  <a.renevier@sisa.samsung.com>
    280
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r146430 r147038  
    21432143                                }
    21442144
    2145                                 my $nativeValue;
     2145                                push(@implContent, "    " . GetNativeTypeFromSignature($attribute->signature) . " nativeValue(" . JSValueToNative($attribute->signature, "value") . ");\n");
     2146                                push(@implContent, "    if (exec->hadException())\n");
     2147                                push(@implContent, "        return;\n");
     2148
    21462149                                if ($codeGenerator->IsEnumType($type)) {
    2147                                     push(@implContent, "    const String string = value.isEmpty() ? String() : value.toString(exec)->value(exec);\n");
    2148                                     push(@implContent, "    if (exec->hadException())\n");
    2149                                     push(@implContent, "        return;\n");
    21502150                                    my @enumValues = $codeGenerator->ValidEnumValues($type);
    21512151                                    my @enumChecks = ();
    21522152                                    foreach my $enumValue (@enumValues) {
    2153                                         push(@enumChecks, "string != \"$enumValue\"");
     2153                                        push(@enumChecks, "nativeValue != \"$enumValue\"");
    21542154                                    }
    21552155                                    push (@implContent, "    if (" . join(" && ", @enumChecks) . ")\n");
    21562156                                    push (@implContent, "        return;\n");
    2157                                     $nativeValue = "string";
    2158                                 } else {
    2159                                     $nativeValue = JSValueToNative($attribute->signature, "value");
    21602157                                }
    21612158
     
    21702167                                    push(@implContent, "    $svgPropertyOrListPropertyType& podImpl = impl->propertyReference();\n");
    21712168                                    if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber
    2172                                         push(@implContent, "    podImpl = $nativeValue;\n");
     2169                                        push(@implContent, "    podImpl = nativeValue;\n");
    21732170                                    } else {
    2174                                         push(@implContent, "    podImpl.set$implSetterFunctionName($nativeValue");
     2171                                        push(@implContent, "    podImpl.set$implSetterFunctionName(nativeValue");
    21752172                                        push(@implContent, ", ec") if @{$attribute->setterExceptions};
    21762173                                        push(@implContent, ");\n");
     
    21872184                                } else {
    21882185                                    my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute);
    2189                                     push(@arguments, $nativeValue);
     2186                                    push(@arguments, "nativeValue");
    21902187                                    if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) {
    21912188                                        my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"};
     
    30983095    "NodeFilter" => "RefPtr<NodeFilter>",
    30993096    "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
     3097    "Date" => "double",
    31003098    "Dictionary" => "Dictionary",
    31013099    "any" => "ScriptValue",
     
    31273125
    31283126    return "Vector<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">" if $arrayOrSequenceType;
     3127
     3128    if ($codeGenerator->IsEnumType($type)) {
     3129        return "const String";
     3130    }
    31293131
    31303132    # For all other types, the native type is a pointer with same type name as the IDL type.
     
    32723274        }
    32733275        return "toNativeArray<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">(exec, $value)";
     3276    }
     3277
     3278    if ($codeGenerator->IsEnumType($type)) {
     3279        return "$value.isEmpty() ? String() : $value.toString(exec)->value(exec)";
    32743280    }
    32753281
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r143304 r147038  
    340340{
    341341    UNUSED_PARAM(exec);
    342     TestSupplemental::setSupplementalStaticAttr(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     342    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     343    if (exec->hadException())
     344        return;
     345    TestSupplemental::setSupplementalStaticAttr(nativeValue);
    343346}
    344347
     
    351354    JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject);
    352355    TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
    353     TestSupplemental::setSupplementalStr2(impl, value.isEmpty() ? String() : value.toString(exec)->value(exec));
     356    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     357    if (exec->hadException())
     358        return;
     359    TestSupplemental::setSupplementalStr2(impl, nativeValue);
    354360}
    355361
     
    371377    JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject);
    372378    TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
    373     TestSupplemental::setSupplementalNode(impl, toNode(value));
     379    Node* nativeValue(toNode(value));
     380    if (exec->hadException())
     381        return;
     382    TestSupplemental::setSupplementalNode(impl, nativeValue);
    374383}
    375384
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r146430 r147038  
    10771077{
    10781078    UNUSED_PARAM(exec);
    1079     TestObj::setStaticStringAttr(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1079    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1080    if (exec->hadException())
     1081        return;
     1082    TestObj::setStaticStringAttr(nativeValue);
    10801083}
    10811084
     
    10861089    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    10871090    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1088     const String string = value.isEmpty() ? String() : value.toString(exec)->value(exec);
    1089     if (exec->hadException())
    1090         return;
    1091     if (string != "" && string != "EnumValue1" && string != "EnumValue2" && string != "EnumValue3")
    1092         return;
    1093     impl->setEnumAttr(string);
     1091    const String nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1092    if (exec->hadException())
     1093        return;
     1094    if (nativeValue != "" && nativeValue != "EnumValue1" && nativeValue != "EnumValue2" && nativeValue != "EnumValue3")
     1095        return;
     1096    impl->setEnumAttr(nativeValue);
    10941097}
    10951098
     
    11001103    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11011104    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1102     impl->setShortAttr(toInt32(exec, value, NormalConversion));
     1105    short nativeValue(toInt32(exec, value, NormalConversion));
     1106    if (exec->hadException())
     1107        return;
     1108    impl->setShortAttr(nativeValue);
    11031109}
    11041110
     
    11091115    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11101116    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1111     impl->setUnsignedShortAttr(toUInt32(exec, value, NormalConversion));
     1117    unsigned short nativeValue(toUInt32(exec, value, NormalConversion));
     1118    if (exec->hadException())
     1119        return;
     1120    impl->setUnsignedShortAttr(nativeValue);
    11121121}
    11131122
     
    11181127    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11191128    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1120     impl->setLongAttr(toInt32(exec, value, NormalConversion));
     1129    int nativeValue(toInt32(exec, value, NormalConversion));
     1130    if (exec->hadException())
     1131        return;
     1132    impl->setLongAttr(nativeValue);
    11211133}
    11221134
     
    11271139    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11281140    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1129     impl->setLongLongAttr(toInt64(exec, value, NormalConversion));
     1141    long long nativeValue(toInt64(exec, value, NormalConversion));
     1142    if (exec->hadException())
     1143        return;
     1144    impl->setLongLongAttr(nativeValue);
    11301145}
    11311146
     
    11361151    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11371152    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1138     impl->setUnsignedLongLongAttr(toUInt64(exec, value, NormalConversion));
     1153    unsigned long long nativeValue(toUInt64(exec, value, NormalConversion));
     1154    if (exec->hadException())
     1155        return;
     1156    impl->setUnsignedLongLongAttr(nativeValue);
    11391157}
    11401158
     
    11451163    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11461164    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1147     impl->setStringAttr(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1165    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1166    if (exec->hadException())
     1167        return;
     1168    impl->setStringAttr(nativeValue);
    11481169}
    11491170
     
    11541175    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11551176    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1156     impl->setTestObjAttr(toTestObj(value));
     1177    TestObj* nativeValue(toTestObj(value));
     1178    if (exec->hadException())
     1179        return;
     1180    impl->setTestObjAttr(nativeValue);
    11571181}
    11581182
     
    11631187    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11641188    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1165     impl->setXMLObjAttr(toTestObj(value));
     1189    TestObj* nativeValue(toTestObj(value));
     1190    if (exec->hadException())
     1191        return;
     1192    impl->setXMLObjAttr(nativeValue);
    11661193}
    11671194
     
    11721199    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11731200    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1174     impl->setCreate(value.toBoolean(exec));
     1201    bool nativeValue(value.toBoolean(exec));
     1202    if (exec->hadException())
     1203        return;
     1204    impl->setCreate(nativeValue);
    11751205}
    11761206
     
    11811211    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11821212    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1183     impl->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, valueToStringWithNullCheck(exec, value));
     1213    const String& nativeValue(valueToStringWithNullCheck(exec, value));
     1214    if (exec->hadException())
     1215        return;
     1216    impl->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, nativeValue);
    11841217}
    11851218
     
    11901223    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    11911224    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1192     impl->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, toInt32(exec, value, NormalConversion));
     1225    int nativeValue(toInt32(exec, value, NormalConversion));
     1226    if (exec->hadException())
     1227        return;
     1228    impl->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, nativeValue);
    11931229}
    11941230
     
    11991235    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12001236    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1201     impl->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, toUInt32(exec, value, NormalConversion));
     1237    unsigned nativeValue(toUInt32(exec, value, NormalConversion));
     1238    if (exec->hadException())
     1239        return;
     1240    impl->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, nativeValue);
    12021241}
    12031242
     
    12081247    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12091248    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1210     impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean(exec));
     1249    bool nativeValue(value.toBoolean(exec));
     1250    if (exec->hadException())
     1251        return;
     1252    impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, nativeValue);
    12111253}
    12121254
     
    12171259    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12181260    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1219     impl->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, valueToStringWithNullCheck(exec, value));
     1261    const String& nativeValue(valueToStringWithNullCheck(exec, value));
     1262    if (exec->hadException())
     1263        return;
     1264    impl->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, nativeValue);
    12201265}
    12211266
     
    12261271    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12271272    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1228     impl->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, valueToStringWithNullCheck(exec, value));
     1273    const String& nativeValue(valueToStringWithNullCheck(exec, value));
     1274    if (exec->hadException())
     1275        return;
     1276    impl->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, nativeValue);
    12291277}
    12301278
     
    12351283    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12361284    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1237     impl->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, toInt32(exec, value, NormalConversion));
     1285    int nativeValue(toInt32(exec, value, NormalConversion));
     1286    if (exec->hadException())
     1287        return;
     1288    impl->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, nativeValue);
    12381289}
    12391290
     
    12441295    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12451296    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1246     impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value.toBoolean(exec));
     1297    bool nativeValue(value.toBoolean(exec));
     1298    if (exec->hadException())
     1299        return;
     1300    impl->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, nativeValue);
    12471301}
    12481302
     
    12531307    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12541308    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1255     impl->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, valueToStringWithNullCheck(exec, value));
     1309    const String& nativeValue(valueToStringWithNullCheck(exec, value));
     1310    if (exec->hadException())
     1311        return;
     1312    impl->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, nativeValue);
    12561313}
    12571314
     
    12621319    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12631320    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1264     impl->setTypedArrayAttr(toFloat32Array(value));
     1321    Float32Array* nativeValue(toFloat32Array(value));
     1322    if (exec->hadException())
     1323        return;
     1324    impl->setTypedArrayAttr(nativeValue);
    12651325}
    12661326
     
    12711331    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12721332    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1273     impl->setAttrWithGetterException(toInt32(exec, value, NormalConversion));
     1333    int nativeValue(toInt32(exec, value, NormalConversion));
     1334    if (exec->hadException())
     1335        return;
     1336    impl->setAttrWithGetterException(nativeValue);
    12741337}
    12751338
     
    12811344    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    12821345    ExceptionCode ec = 0;
    1283     impl->setAttrWithSetterException(toInt32(exec, value, NormalConversion), ec);
     1346    int nativeValue(toInt32(exec, value, NormalConversion));
     1347    if (exec->hadException())
     1348        return;
     1349    impl->setAttrWithSetterException(nativeValue, ec);
    12841350    setDOMException(exec, ec);
    12851351}
     
    12911357    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    12921358    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1293     impl->setStringAttrWithGetterException(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1359    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1360    if (exec->hadException())
     1361        return;
     1362    impl->setStringAttrWithGetterException(nativeValue);
    12941363}
    12951364
     
    13011370    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    13021371    ExceptionCode ec = 0;
    1303     impl->setStringAttrWithSetterException(value.isEmpty() ? String() : value.toString(exec)->value(exec), ec);
     1372    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     1373    if (exec->hadException())
     1374        return;
     1375    impl->setStringAttrWithSetterException(nativeValue, ec);
    13041376    setDOMException(exec, ec);
    13051377}
     
    13181390    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13191391    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1320     impl->setWithScriptStateAttribute(exec, toInt32(exec, value, NormalConversion));
     1392    int nativeValue(toInt32(exec, value, NormalConversion));
     1393    if (exec->hadException())
     1394        return;
     1395    impl->setWithScriptStateAttribute(exec, nativeValue);
    13211396}
    13221397
     
    13271402    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13281403    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     1404    TestObj* nativeValue(toTestObj(value));
     1405    if (exec->hadException())
     1406        return;
    13291407    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    13301408    if (!scriptContext)
    13311409        return;
    1332     impl->setWithScriptExecutionContextAttribute(scriptContext, toTestObj(value));
     1410    impl->setWithScriptExecutionContextAttribute(scriptContext, nativeValue);
    13331411}
    13341412
     
    13391417    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13401418    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1341     impl->setWithScriptStateAttributeRaises(exec, toTestObj(value));
     1419    TestObj* nativeValue(toTestObj(value));
     1420    if (exec->hadException())
     1421        return;
     1422    impl->setWithScriptStateAttributeRaises(exec, nativeValue);
    13421423}
    13431424
     
    13481429    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13491430    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     1431    TestObj* nativeValue(toTestObj(value));
     1432    if (exec->hadException())
     1433        return;
    13501434    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    13511435    if (!scriptContext)
    13521436        return;
    1353     impl->setWithScriptExecutionContextAttributeRaises(scriptContext, toTestObj(value));
     1437    impl->setWithScriptExecutionContextAttributeRaises(scriptContext, nativeValue);
    13541438}
    13551439
     
    13601444    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13611445    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     1446    TestObj* nativeValue(toTestObj(value));
     1447    if (exec->hadException())
     1448        return;
    13621449    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    13631450    if (!scriptContext)
    13641451        return;
    1365     impl->setWithScriptExecutionContextAndScriptStateAttribute(exec, scriptContext, toTestObj(value));
     1452    impl->setWithScriptExecutionContextAndScriptStateAttribute(exec, scriptContext, nativeValue);
    13661453}
    13671454
     
    13721459    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13731460    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     1461    TestObj* nativeValue(toTestObj(value));
     1462    if (exec->hadException())
     1463        return;
    13741464    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    13751465    if (!scriptContext)
    13761466        return;
    1377     impl->setWithScriptExecutionContextAndScriptStateAttributeRaises(exec, scriptContext, toTestObj(value));
     1467    impl->setWithScriptExecutionContextAndScriptStateAttributeRaises(exec, scriptContext, nativeValue);
    13781468}
    13791469
     
    13841474    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13851475    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     1476    TestObj* nativeValue(toTestObj(value));
     1477    if (exec->hadException())
     1478        return;
    13861479    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    13871480    if (!scriptContext)
    13881481        return;
    1389     impl->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(exec, scriptContext, toTestObj(value));
     1482    impl->setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(exec, scriptContext, nativeValue);
    13901483}
    13911484
     
    13961489    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    13971490    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1398     impl->setWithScriptArgumentsAndCallStackAttribute(toTestObj(value));
     1491    TestObj* nativeValue(toTestObj(value));
     1492    if (exec->hadException())
     1493        return;
     1494    impl->setWithScriptArgumentsAndCallStackAttribute(nativeValue);
    13991495}
    14001496
     
    14061502    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14071503    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1408     impl->setConditionalAttr1(toInt32(exec, value, NormalConversion));
     1504    int nativeValue(toInt32(exec, value, NormalConversion));
     1505    if (exec->hadException())
     1506        return;
     1507    impl->setConditionalAttr1(nativeValue);
    14091508}
    14101509
     
    14171516    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14181517    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1419     impl->setConditionalAttr2(toInt32(exec, value, NormalConversion));
     1518    int nativeValue(toInt32(exec, value, NormalConversion));
     1519    if (exec->hadException())
     1520        return;
     1521    impl->setConditionalAttr2(nativeValue);
    14201522}
    14211523
     
    14281530    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14291531    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1430     impl->setConditionalAttr3(toInt32(exec, value, NormalConversion));
     1532    int nativeValue(toInt32(exec, value, NormalConversion));
     1533    if (exec->hadException())
     1534        return;
     1535    impl->setConditionalAttr3(nativeValue);
    14311536}
    14321537
     
    14681573    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14691574    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1470     impl->setAnyAttribute(exec->globalData(), value);
     1575    ScriptValue nativeValue(exec->globalData(), value);
     1576    if (exec->hadException())
     1577        return;
     1578    impl->setAnyAttribute(nativeValue);
    14711579}
    14721580
     
    14771585    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14781586    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1479     impl->setMutablePoint(toSVGPoint(value));
     1587    SVGPropertyTearOff<FloatPoint>* nativeValue(toSVGPoint(value));
     1588    if (exec->hadException())
     1589        return;
     1590    impl->setMutablePoint(nativeValue);
    14801591}
    14811592
     
    14861597    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14871598    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1488     impl->setImmutablePoint(toSVGPoint(value));
     1599    SVGPropertyTearOff<FloatPoint>* nativeValue(toSVGPoint(value));
     1600    if (exec->hadException())
     1601        return;
     1602    impl->setImmutablePoint(nativeValue);
    14891603}
    14901604
     
    14951609    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    14961610    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1497     impl->setBlueberry(toInt32(exec, value, NormalConversion));
     1611    int nativeValue(toInt32(exec, value, NormalConversion));
     1612    if (exec->hadException())
     1613        return;
     1614    impl->setBlueberry(nativeValue);
    14981615}
    14991616
     
    15041621    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    15051622    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1506     impl->setStrictFloat(value.toFloat(exec));
     1623    float nativeValue(value.toFloat(exec));
     1624    if (exec->hadException())
     1625        return;
     1626    impl->setStrictFloat(nativeValue);
    15071627}
    15081628
     
    15131633    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    15141634    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1515     impl->setId(toInt32(exec, value, NormalConversion));
     1635    int nativeValue(toInt32(exec, value, NormalConversion));
     1636    if (exec->hadException())
     1637        return;
     1638    impl->setId(nativeValue);
    15161639}
    15171640
     
    15301653    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    15311654    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1532     impl->setNullableLongSettableAttribute(toInt32(exec, value, NormalConversion));
     1655    int nativeValue(toInt32(exec, value, NormalConversion));
     1656    if (exec->hadException())
     1657        return;
     1658    impl->setNullableLongSettableAttribute(nativeValue);
    15331659}
    15341660
     
    15391665    JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
    15401666    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
    1541     impl->setNullableStringValue(toInt32(exec, value, NormalConversion));
     1667    int nativeValue(toInt32(exec, value, NormalConversion));
     1668    if (exec->hadException())
     1669        return;
     1670    impl->setNullableStringValue(nativeValue);
    15421671}
    15431672
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r143304 r147038  
    258258    JSTestSerializedScriptValueInterface* castedThis = jsCast<JSTestSerializedScriptValueInterface*>(thisObject);
    259259    TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
    260     impl->setValue(SerializedScriptValue::create(exec, value, 0, 0));
     260    RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
     261    if (exec->hadException())
     262        return;
     263    impl->setValue(nativeValue);
    261264}
    262265
     
    267270    JSTestSerializedScriptValueInterface* castedThis = jsCast<JSTestSerializedScriptValueInterface*>(thisObject);
    268271    TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
    269     impl->setCachedValue(SerializedScriptValue::create(exec, value, 0, 0));
     272    RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
     273    if (exec->hadException())
     274        return;
     275    impl->setCachedValue(nativeValue);
    270276}
    271277
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r146430 r147038  
    281281    JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
    282282    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    283     impl->setUnsignedLongLongAttr(toUInt64(exec, value, NormalConversion));
     283    unsigned long long nativeValue(toUInt64(exec, value, NormalConversion));
     284    if (exec->hadException())
     285        return;
     286    impl->setUnsignedLongLongAttr(nativeValue);
    284287}
    285288
     
    290293    JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
    291294    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    292     impl->setImmutableSerializedScriptValue(SerializedScriptValue::create(exec, value, 0, 0));
     295    RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
     296    if (exec->hadException())
     297        return;
     298    impl->setImmutableSerializedScriptValue(nativeValue);
    293299}
    294300
     
    299305    JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
    300306    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    301     impl->setAttrWithGetterException(toInt32(exec, value, NormalConversion));
     307    int nativeValue(toInt32(exec, value, NormalConversion));
     308    if (exec->hadException())
     309        return;
     310    impl->setAttrWithGetterException(nativeValue);
    302311}
    303312
     
    309318    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    310319    ExceptionCode ec = 0;
    311     impl->setAttrWithSetterException(toInt32(exec, value, NormalConversion), ec);
     320    int nativeValue(toInt32(exec, value, NormalConversion));
     321    if (exec->hadException())
     322        return;
     323    impl->setAttrWithSetterException(nativeValue, ec);
    312324    setDOMException(exec, ec);
    313325}
     
    319331    JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
    320332    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    321     impl->setStringAttrWithGetterException(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     333    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     334    if (exec->hadException())
     335        return;
     336    impl->setStringAttrWithGetterException(nativeValue);
    322337}
    323338
     
    329344    TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
    330345    ExceptionCode ec = 0;
    331     impl->setStringAttrWithSetterException(value.isEmpty() ? String() : value.toString(exec)->value(exec), ec);
     346    const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
     347    if (exec->hadException())
     348        return;
     349    impl->setStringAttrWithSetterException(nativeValue, ec);
    332350    setDOMException(exec, ec);
    333351}
Note: See TracChangeset for help on using the changeset viewer.