WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
168293
[WebIDL] Improve serializer = { inherit }
https://bugs.webkit.org/show_bug.cgi?id=168293
Summary
[WebIDL] Improve serializer = { inherit }
Joseph Pecoraro
Reported
2017-02-14 00:53:40 PST
This improves, and fixes serializer = { inherit } now that I have a class where I can test it. Given:
> interface TestSerialization { > attribute long a; > attribute long b; > attribute long c; > serializer = { attribute }; > };
>
> interface TestSerializationFinal : TestSerialization { > attribute long x; > attribute long y; > serializer = { inherit, attribute }; > };
The existing code would have compiler errors for TestSerializationFinal trying to access static inline functions that only exist inside of TestSerialization.cpp when trying to generate the toJSON serializer for TestSerializationFinal. I will change serializer generation to create an exposed serialize method which does what we do now:
> class JSTestSerialization : public JSDOMWrapper<TestSerialization> { > public: > ... > static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerialization* thisObject, JSC::ThrowScope&); > ... > };
Which any subclass (a serializer with {inherit}) can use to get the parent's serialization:
> JSC::JSObject* JSTestSerializationInherit::serialize(ExecState* state, JSTestSerializationInherit* thisObject, ThrowScope& throwScope) > { > auto& vm = state->vm(); > auto* result = JSTestSerialization::serialize(state, thisObject, throwScope);
>
> auto inheritLongAttributeValue = jsTestSerializationInheritX(*state, *thisObject, throwScope); > ASSERT(!throwScope.exception()); > result->putDirect(vm, Identifier::fromString(&vm, "x"), inheritLongAttributeValue);
>
> auto inheritLongAttributeValue = jsTestSerializationInheritY(*state, *thisObject, throwScope); > ASSERT(!throwScope.exception()); > result->putDirect(vm, Identifier::fromString(&vm, "y"), inheritLongAttributeValue);
>
> return result; > }
This is way better (each class only needs to generate for its own accessors) and more importantly it actually works!
Attachments
[PATCH] Proposed Fix
(21.70 KB, patch)
2017-02-14 00:58 PST
,
Joseph Pecoraro
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Joseph Pecoraro
Comment 1
2017-02-14 00:58:56 PST
Created
attachment 301474
[details]
[PATCH] Proposed Fix
youenn fablet
Comment 2
2017-02-14 22:04:10 PST
Comment on
attachment 301474
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=301474&action=review
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1938 > + push(@headerContent, " static JSC::JSObject* serialize(JSC::ExecState*, JS${interfaceName}* thisObject, JSC::ThrowScope&);\n") if $interface->serializable;
Can we pass ExecState& and JSXX& instead of pointers?
Joseph Pecoraro
Comment 3
2017-02-14 22:47:49 PST
(In reply to
comment #2
)
> Comment on
attachment 301474
[details]
> [PATCH] Proposed Fix > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=301474&action=review
> > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1938 > > + push(@headerContent, " static JSC::JSObject* serialize(JSC::ExecState*, JS${interfaceName}* thisObject, JSC::ThrowScope&);\n") if $interface->serializable; > > Can we pass ExecState& and JSXX& instead of pointers?
Hmm, probably. I'll look at that in a follow-up if I have time. This uses whatever the existing bindings code expects, so I'm going to keep it consistent for now. Thanks for the review!
WebKit Commit Bot
Comment 4
2017-02-14 23:13:44 PST
Comment on
attachment 301474
[details]
[PATCH] Proposed Fix Clearing flags on attachment: 301474 Committed
r212344
: <
http://trac.webkit.org/changeset/212344
>
WebKit Commit Bot
Comment 5
2017-02-14 23:13:50 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug