Title: [212344] trunk/Source/WebCore
Revision
212344
Author
[email protected]
Date
2017-02-14 23:12:05 -0800 (Tue, 14 Feb 2017)

Log Message

[WebIDL] Improve serializer = { inherit }
https://bugs.webkit.org/show_bug.cgi?id=168293

Patch by Joseph Pecoraro <[email protected]> on 2017-02-14
Reviewed by Youenn Fablet.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
Expose a serialize() method on the interface.

(GenerateSerializerFunction):
(GenerateSerializerAttributesForInterface): Deleted.
Subclasses that have `serializer = { inherit }` can use
their parent's serialize() method to get the initial object.
We can now collapse everything back into a single function
because we only generate code for our own attributes.

* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::serialize):
(WebCore::jsTestNodePrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::serialize):
(WebCore::jsTestObjPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::JSTestSerialization::serialize):
(WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerialization.h:
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
(WebCore::JSTestSerializationInherit::serialize):
(WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerializationInherit.h:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
(WebCore::JSTestSerializationInheritFinal::serialize):
(WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
Updated results.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (212343 => 212344)


--- trunk/Source/WebCore/ChangeLog	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/ChangeLog	2017-02-15 07:12:05 UTC (rev 212344)
@@ -1,3 +1,43 @@
+2017-02-14  Joseph Pecoraro  <[email protected]>
+
+        [WebIDL] Improve serializer = { inherit }
+        https://bugs.webkit.org/show_bug.cgi?id=168293
+
+        Reviewed by Youenn Fablet.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        Expose a serialize() method on the interface.
+
+        (GenerateSerializerFunction):
+        (GenerateSerializerAttributesForInterface): Deleted.
+        Subclasses that have `serializer = { inherit }` can use
+        their parent's serialize() method to get the initial object.
+        We can now collapse everything back into a single function
+        because we only generate code for our own attributes.
+
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        (WebCore::JSTestNode::serialize):
+        (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestNode.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObj::serialize):
+        (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/JS/JSTestSerialization.cpp:
+        (WebCore::JSTestSerialization::serialize):
+        (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerialization.h:
+        * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
+        (WebCore::JSTestSerializationInherit::serialize):
+        (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerializationInherit.h:
+        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
+        (WebCore::JSTestSerializationInheritFinal::serialize):
+        (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
+        Updated results.
+
 2017-02-14  Aakash Jain  <[email protected]>
 
         Move methods from WebCoreThread.h to WebCoreThreadInternal.h

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-02-15 07:12:05 UTC (rev 212344)
@@ -1934,6 +1934,9 @@
         push(@headerContent, "    static JSC::JSValue getNamedConstructor(JSC::VM&, JSC::JSGlobalObject*);\n") if $interface->extendedAttributes->{NamedConstructor};
     }
 
+    # Serializer function.
+    push(@headerContent, "    static JSC::JSObject* serialize(JSC::ExecState*, JS${interfaceName}* thisObject, JSC::ThrowScope&);\n") if $interface->serializable;
+
     my $numCustomFunctions = 0;
     my $numCustomAttributes = 0;
 
@@ -4394,36 +4397,8 @@
 
     my $interfaceName = $interface->type->name;
 
-    my $serializerFunctionName = "toJSON";
-    my $serializerNativeFunctionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($serializerFunctionName);
-
-    AddToImplIncludes("<runtime/ObjectConstructor.h>");
-    push(@implContent, "static inline EncodedJSValue ${serializerNativeFunctionName}Caller(ExecState* state, JS$interfaceName* thisObject, JSC::ThrowScope& throwScope)\n");
-    push(@implContent, "{\n");
-    push(@implContent, "    auto& vm = state->vm();\n");
-    push(@implContent, "    auto* result = constructEmptyObject(state);\n");
-    push(@implContent, "\n");
-
-    GenerateSerializerAttributesForInterface($interface, $className);
-
-    push(@implContent, "    return JSValue::encode(result);\n");
-    push(@implContent, "}\n");
-    push(@implContent, "\n");
-    push(@implContent, "EncodedJSValue JSC_HOST_CALL ${serializerNativeFunctionName}(ExecState* state)\n");
-    push(@implContent, "{\n");
-    push(@implContent, "    return BindingCaller<JS$interfaceName>::callOperation<${serializerNativeFunctionName}Caller>(state, \"$serializerFunctionName\");\n");
-    push(@implContent, "}\n");
-    push(@implContent, "\n");
-}
-
-sub GenerateSerializerAttributesForInterface
-{
-    my ($interface, $className) = @_;
-
-    my $interfaceName = $interface->type->name;
-
+    my $parentSerializerInterface = 0;
     if ($interface->serializable->hasInherit) {
-        my $parentSerializerInterface = 0;
         $codeGenerator->ForAllParents($interface, sub {
             my $parentInterface = shift;
             if ($parentInterface->serializable && !$parentSerializerInterface) {
@@ -4430,10 +4405,7 @@
                 $parentSerializerInterface = $parentInterface;
             }
         }, 0);
-
         die "Failed to find parent interface with \"serializer\" for \"inherit\" serializer in $interfaceName\n" if !$parentSerializerInterface;
-
-        GenerateSerializerAttributesForInterface($parentSerializerInterface, $className);
     }
 
     my @serializedAttributes = ();
@@ -4451,13 +4423,28 @@
                 last;
             }
         }
-        
         die "Failed to find \"serializer\" attribute \"$attributeName\" in $interfaceName\n" if !$foundAttribute;
     }
 
+    my $serializerFunctionName = "toJSON";
+    my $serializerNativeFunctionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($serializerFunctionName);
+
+    AddToImplIncludes("<runtime/ObjectConstructor.h>");
+
+    push(@implContent, "JSC::JSObject* JS${interfaceName}::serialize(ExecState* state, JS${interfaceName}* thisObject, ThrowScope& throwScope)\n");
+    push(@implContent, "{\n");
+    push(@implContent, "    auto& vm = state->vm();\n");
+
+    if ($interface->serializable->hasInherit) {
+        my $parentSerializerInterfaceName = $parentSerializerInterface->type->name;
+        push(@implContent, "    auto* result = JS${parentSerializerInterfaceName}::serialize(state, thisObject, throwScope);\n");
+    } else {
+        push(@implContent, "    auto* result = constructEmptyObject(state);\n");
+    }
+    push(@implContent, "\n");
+
     foreach my $attribute (@serializedAttributes) {
         my $name = $attribute->name;
-
         my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
         push(@implContent, "    auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
         push(@implContent, "    ASSERT(!throwScope.exception());\n");
@@ -4464,6 +4451,21 @@
         push(@implContent, "    result->putDirect(vm, Identifier::fromString(&vm, \"${name}\"), ${name}Value);\n");
         push(@implContent, "\n");
     }
+
+    push(@implContent, "    return result;\n");
+    push(@implContent, "}\n");
+    push(@implContent, "\n");
+
+    push(@implContent, "static inline EncodedJSValue ${serializerNativeFunctionName}Caller(ExecState* state, JS${interfaceName}* thisObject, JSC::ThrowScope& throwScope)\n");
+    push(@implContent, "{\n");
+    push(@implContent, "    return JSValue::encode(JS${interfaceName}::serialize(state, thisObject, throwScope));\n");
+    push(@implContent, "}\n");
+    push(@implContent, "\n");
+    push(@implContent, "EncodedJSValue JSC_HOST_CALL ${serializerNativeFunctionName}(ExecState* state)\n");
+    push(@implContent, "{\n");
+    push(@implContent, "    return BindingCaller<JS$interfaceName>::callOperation<${serializerNativeFunctionName}Caller>(state, \"$serializerFunctionName\");\n");
+    push(@implContent, "}\n");
+    push(@implContent, "\n");
 }
 
 sub GenerateCallWithUsingReferences

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2017-02-15 07:12:05 UTC (rev 212344)
@@ -337,7 +337,7 @@
     return BindingCaller<JSTestNode>::callOperation<jsTestNodePrototypeFunctionForEachCaller>(state, "forEach");
 }
 
-static inline EncodedJSValue jsTestNodePrototypeFunctionToJSONCaller(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope& throwScope)
+JSC::JSObject* JSTestNode::serialize(ExecState* state, JSTestNode* thisObject, ThrowScope& throwScope)
 {
     auto& vm = state->vm();
     auto* result = constructEmptyObject(state);
@@ -346,9 +346,14 @@
     ASSERT(!throwScope.exception());
     result->putDirect(vm, Identifier::fromString(&vm, "name"), nameValue);
 
-    return JSValue::encode(result);
+    return result;
 }
 
+static inline EncodedJSValue jsTestNodePrototypeFunctionToJSONCaller(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(JSTestNode::serialize(state, thisObject, throwScope));
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionToJSON(ExecState* state)
 {
     return BindingCaller<JSTestNode>::callOperation<jsTestNodePrototypeFunctionToJSONCaller>(state, "toJSON");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h	2017-02-15 07:12:05 UTC (rev 212344)
@@ -47,6 +47,7 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestNode* thisObject, JSC::ThrowScope&);
     static void visitChildren(JSCell*, JSC::SlotVisitor&);
 
     TestNode& wrapped() const

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2017-02-15 07:12:05 UTC (rev 212344)
@@ -8578,7 +8578,7 @@
     return JSValue::encode(toJS<IDLUSVString>(*state, impl.stringifierAttribute()));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionToJSONCaller(ExecState* state, JSTestObj* thisObject, JSC::ThrowScope& throwScope)
+JSC::JSObject* JSTestObj::serialize(ExecState* state, JSTestObj* thisObject, ThrowScope& throwScope)
 {
     auto& vm = state->vm();
     auto* result = constructEmptyObject(state);
@@ -8599,9 +8599,14 @@
     ASSERT(!throwScope.exception());
     result->putDirect(vm, Identifier::fromString(&vm, "longAttr"), longAttrValue);
 
-    return JSValue::encode(result);
+    return result;
 }
 
+static inline EncodedJSValue jsTestObjPrototypeFunctionToJSONCaller(ExecState* state, JSTestObj* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(JSTestObj::serialize(state, thisObject, throwScope));
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToJSON(ExecState* state)
 {
     return BindingCaller<JSTestObj>::callOperation<jsTestObjPrototypeFunctionToJSONCaller>(state, "toJSON");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2017-02-15 07:12:05 UTC (rev 212344)
@@ -53,6 +53,7 @@
 
     static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestObj* thisObject, JSC::ThrowScope&);
     mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
     mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2;
     static void visitChildren(JSCell*, JSC::SlotVisitor&);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp	2017-02-15 07:12:05 UTC (rev 212344)
@@ -400,7 +400,7 @@
     return getDOMConstructor<JSTestSerializationConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
 }
 
-static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope& throwScope)
+JSC::JSObject* JSTestSerialization::serialize(ExecState* state, JSTestSerialization* thisObject, ThrowScope& throwScope)
 {
     auto& vm = state->vm();
     auto* result = constructEmptyObject(state);
@@ -425,9 +425,14 @@
     ASSERT(!throwScope.exception());
     result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
 
-    return JSValue::encode(result);
+    return result;
 }
 
+static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(JSTestSerialization::serialize(state, thisObject, throwScope));
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(ExecState* state)
 {
     return BindingCaller<JSTestSerialization>::callOperation<jsTestSerializationPrototypeFunctionToJSONCaller>(state, "toJSON");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h	2017-02-15 07:12:05 UTC (rev 212344)
@@ -49,6 +49,7 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerialization* thisObject, JSC::ThrowScope&);
 protected:
     JSTestSerialization(JSC::Structure*, JSDOMGlobalObject&, Ref<TestSerialization>&&);
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp	2017-02-15 07:12:05 UTC (rev 212344)
@@ -201,38 +201,23 @@
     return getDOMConstructor<JSTestSerializationInheritConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
 }
 
-static inline EncodedJSValue jsTestSerializationInheritPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInherit* thisObject, JSC::ThrowScope& throwScope)
+JSC::JSObject* JSTestSerializationInherit::serialize(ExecState* state, JSTestSerializationInherit* thisObject, ThrowScope& throwScope)
 {
     auto& vm = state->vm();
-    auto* result = constructEmptyObject(state);
+    auto* result = JSTestSerialization::serialize(state, thisObject, throwScope);
 
-    auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
-
-    auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
-
-    auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
-
-    auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
-
-    auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
-
     auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
     ASSERT(!throwScope.exception());
     result->putDirect(vm, Identifier::fromString(&vm, "inheritLongAttribute"), inheritLongAttributeValue);
 
-    return JSValue::encode(result);
+    return result;
 }
 
+static inline EncodedJSValue jsTestSerializationInheritPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInherit* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(JSTestSerializationInherit::serialize(state, thisObject, throwScope));
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestSerializationInheritPrototypeFunctionToJSON(ExecState* state)
 {
     return BindingCaller<JSTestSerializationInherit>::callOperation<jsTestSerializationInheritPrototypeFunctionToJSONCaller>(state, "toJSON");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h	2017-02-15 07:12:05 UTC (rev 212344)
@@ -47,6 +47,7 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerializationInherit* thisObject, JSC::ThrowScope&);
     TestSerializationInherit& wrapped() const
     {
         return static_cast<TestSerializationInherit&>(Base::wrapped());

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp	2017-02-15 07:12:05 UTC (rev 212344)
@@ -239,42 +239,23 @@
     return getDOMConstructor<JSTestSerializationInheritFinalConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
 }
 
-static inline EncodedJSValue jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope& throwScope)
+JSC::JSObject* JSTestSerializationInheritFinal::serialize(ExecState* state, JSTestSerializationInheritFinal* thisObject, ThrowScope& throwScope)
 {
     auto& vm = state->vm();
-    auto* result = constructEmptyObject(state);
+    auto* result = JSTestSerializationInherit::serialize(state, thisObject, throwScope);
 
-    auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
-
-    auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
-
-    auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
-
-    auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
-
-    auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
-
-    auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result->putDirect(vm, Identifier::fromString(&vm, "inheritLongAttribute"), inheritLongAttributeValue);
-
     auto finalLongAttributeBarValue = jsTestSerializationInheritFinalFinalLongAttributeBarGetter(*state, *thisObject, throwScope);
     ASSERT(!throwScope.exception());
     result->putDirect(vm, Identifier::fromString(&vm, "finalLongAttributeBar"), finalLongAttributeBarValue);
 
-    return JSValue::encode(result);
+    return result;
 }
 
+static inline EncodedJSValue jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(JSTestSerializationInheritFinal::serialize(state, thisObject, throwScope));
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestSerializationInheritFinalPrototypeFunctionToJSON(ExecState* state)
 {
     return BindingCaller<JSTestSerializationInheritFinal>::callOperation<jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller>(state, "toJSON");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h (212343 => 212344)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h	2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h	2017-02-15 07:12:05 UTC (rev 212344)
@@ -47,6 +47,7 @@
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope&);
     TestSerializationInheritFinal& wrapped() const
     {
         return static_cast<TestSerializationInheritFinal&>(Base::wrapped());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to