WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154413
Binding generator should support key value iterable
https://bugs.webkit.org/show_bug.cgi?id=154413
Summary
Binding generator should support key value iterable
youenn fablet
Reported
2016-02-18 13:56:31 PST
WebIDL iterable keyword should be supported by binding generator. It may be good to start with Key Value iterables.
Attachments
WIP
(40.26 KB, patch)
2016-02-18 14:19 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(44.41 KB, patch)
2016-02-19 07:30 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Throwing in case of bad forEach argument
(46.25 KB, patch)
2016-02-20 03:40 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing - Fixing callback throwing exception
(47.16 KB, patch)
2016-02-21 23:29 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing - Fixing callback throwing exception
(47.16 KB, patch)
2016-02-21 23:30 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2016-02-18 14:19:31 PST
Created
attachment 271694
[details]
WIP
youenn fablet
Comment 2
2016-02-19 07:30:00 PST
Created
attachment 271753
[details]
Patch
youenn fablet
Comment 3
2016-02-20 03:40:42 PST
Created
attachment 271857
[details]
Throwing in case of bad forEach argument
Darin Adler
Comment 4
2016-02-21 17:41:38 PST
Comment on
attachment 271857
[details]
Throwing in case of bad forEach argument View in context:
https://bugs.webkit.org/attachment.cgi?id=271857&action=review
> Source/WebCore/Modules/fetch/FetchHeaders.h:68 > bool next(String& nextKey, String& nextValue);
The interface we have chosen for next is really strange. I think we could come up with something much cleaner. Does this interface come from some standard or is it entirely an internal WebKit thing? Here’s what I find strange: 1) The boolean that returns true only if there is no “next”. That seems really peculiar. 2) The use of two out arguments for the key/value pair. I think that instead we should just use Optional<std::tuple<A, B>> as the return value and not have out arguments at all.
> Source/WebCore/bindings/js/JSKeyValueIterator.h:137 > + JSC::MarkedArgumentBuffer arguments; > + arguments.append(toJS(&state, wrapper->globalObject(), nextValue)); > + arguments.append(toJS(&state, wrapper->globalObject(), nextKey)); > + arguments.append(wrapper); > + JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments);
Loop needs an exit if there’s an exception, right? Can we add a test that covers that case, please?
youenn fablet
Comment 5
2016-02-21 23:29:14 PST
Created
attachment 271908
[details]
Patch for landing - Fixing callback throwing exception
youenn fablet
Comment 6
2016-02-21 23:30:42 PST
Created
attachment 271909
[details]
Patch for landing - Fixing callback throwing exception
youenn fablet
Comment 7
2016-02-21 23:34:25 PST
Thanks for the review. (In reply to
comment #4
)
> Comment on
attachment 271857
[details]
> Throwing in case of bad forEach argument > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=271857&action=review
> > > Source/WebCore/Modules/fetch/FetchHeaders.h:68 > > bool next(String& nextKey, String& nextValue); > > The interface we have chosen for next is really strange. I think we could > come up with something much cleaner. Does this interface come from some > standard or is it entirely an internal WebKit thing? Here’s what I find > strange: > > 1) The boolean that returns true only if there is no “next”. That seems > really peculiar.
This mimics "done" JS iterator JSMapIterator has a next() method returning true.
> 2) The use of two out arguments for the key/value pair. > > I think that instead we should just use Optional<std::tuple<A, B>> as the > return value and not have out arguments at all.
JSMapIterator uses WTF::KeyValuePair as an out parameter. I will tackle this issue as a follow-up bug.
> > Source/WebCore/bindings/js/JSKeyValueIterator.h:137 > > + JSC::MarkedArgumentBuffer arguments; > > + arguments.append(toJS(&state, wrapper->globalObject(), nextValue)); > > + arguments.append(toJS(&state, wrapper->globalObject(), nextKey)); > > + arguments.append(wrapper); > > + JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments); > > Loop needs an exit if there’s an exception, right? Can we add a test that > covers that case, please?
Right. This is fixed in the current patch.
WebKit Commit Bot
Comment 8
2016-02-22 00:31:12 PST
Comment on
attachment 271909
[details]
Patch for landing - Fixing callback throwing exception Clearing flags on attachment: 271909 Committed
r196900
: <
http://trac.webkit.org/changeset/196900
>
WebKit Commit Bot
Comment 9
2016-02-22 00:31:18 PST
All reviewed patches have been landed. Closing bug.
Myles C. Maxfield
Comment 10
2016-02-22 12:08:55 PST
Comment on
attachment 271909
[details]
Patch for landing - Fixing callback throwing exception View in context:
https://bugs.webkit.org/attachment.cgi?id=271909&action=review
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1062 > + push(@headerContent, " using IteratorKey = $keyType;\n");
This isn't going to work for the CSS Font Loading spec. FontFaceSet's iterator needs to be able to return new objects, but the $keyType is a raw pointer. It needs to be able to retain the object returned.
Myles C. Maxfield
Comment 11
2016-02-22 12:10:55 PST
(In reply to
comment #10
)
> Comment on
attachment 271909
[details]
> Patch for landing - Fixing callback throwing exception > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=271909&action=review
> > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1062 > > + push(@headerContent, " using IteratorKey = $keyType;\n"); > > This isn't going to work for the CSS Font Loading spec. FontFaceSet's > iterator needs to be able to return new objects, but the $keyType is a raw > pointer. It needs to be able to retain the object returned.
It looks like there is a special exception for DOMStringList in GetNativeType(). I guess I'll add another exception for FontFace.
Myles C. Maxfield
Comment 12
2016-02-22 12:29:38 PST
Thank you very much for implementing this!!! 👍👍👍👍👍
youenn fablet
Comment 13
2016-02-22 12:43:33 PST
(In reply to
comment #12
)
> Thank you very much for implementing this!!! 👍👍👍👍👍
You 're welcome ;) (In reply to
comment #11
)
> (In reply to
comment #10
) > > Comment on
attachment 271909
[details]
> > Patch for landing - Fixing callback throwing exception > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=271909&action=review
> > > > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1062 > > > + push(@headerContent, " using IteratorKey = $keyType;\n"); > > > > This isn't going to work for the CSS Font Loading spec. FontFaceSet's > > iterator needs to be able to return new objects, but the $keyType is a raw > > pointer. It needs to be able to retain the object returned. > > It looks like there is a special exception for DOMStringList in > GetNativeType(). I guess I'll add another exception for FontFace.
I don't know. Maybe it is better to add a new GetXXType routine that takes care of new objets. cdumez, wdyt ?
youenn fablet
Comment 14
2016-02-23 01:55:58 PST
Patch from
bug 154531
removes the need to tweak the binding generator. See
bug 154577
as a follow-up.
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