WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
161961
callPromiseFunction should be made usable for custom binding code
https://bugs.webkit.org/show_bug.cgi?id=161961
Summary
callPromiseFunction should be made usable for custom binding code
youenn fablet
Reported
2016-09-14 07:26:32 PDT
Custom binding code is not always handling promise correctly as can be seen from SubtleCrypto and getUserMedia, especially the handling of exceptions. Having a wrapper function would be useful for these.
Attachments
Patch
(11.00 KB, patch)
2016-09-14 07:32 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Adding binding test
(22.26 KB, patch)
2016-09-14 08:38 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(22.92 KB, patch)
2016-09-14 23:51 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2016-09-14 07:32:37 PDT
Created
attachment 288812
[details]
Patch
youenn fablet
Comment 2
2016-09-14 08:38:31 PDT
Created
attachment 288817
[details]
Adding binding test
youenn fablet
Comment 3
2016-09-14 08:40:00 PDT
(In reply to
comment #2
)
> Created
attachment 288817
[details]
> Adding binding test
Patch only updates getUserMedia SubtleCrypto should follow with the same routines.
Darin Adler
Comment 4
2016-09-14 10:04:09 PDT
Comment on
attachment 288817
[details]
Adding binding test View in context:
https://bugs.webkit.org/attachment.cgi?id=288817&action=review
> Source/WebCore/bindings/js/JSDOMPromise.h:162 > +template<PromiseFunction promiseFunction, bool canBeCalledInWorker = false>
The use of a boolean here probably makes this hard to read at call sites. Is there a better way do this? We can use our typical enum approach, for example.
> Source/WebCore/bindings/js/JSDOMPromise.h:189 > +template<BindingPromiseFunction bindingPromiseFunction, bool canBeCalledInWorker>
Ditto.
> Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp:386 > + return callPromiseFunction<JSMediaDevicesGetUserMediaPromiseFunction, false>(state);
The "false" here is completely unclear.
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3414 > static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredWrapper>&&); > ${functionReturn} ${functionName}(ExecState* state)
I’d like to see a blank line between these two lines.
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3420 > static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&& deferredWrapper)
There is an extra space here after the "&&".
> LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html:140 > + testPassed(" navigator.mediaDevices.getUserMedia() rejected with error: " + error);
Why the leading space here?
> LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html:143 > testPassed(" navigator.mediaDevices.getUserMedia({}) rejected with error: " + error);
Why the leading space here?
youenn fablet
Comment 5
2016-09-14 23:51:33 PDT
Created
attachment 288933
[details]
Patch for landing
WebKit Commit Bot
Comment 6
2016-09-15 00:23:26 PDT
Comment on
attachment 288933
[details]
Patch for landing Clearing flags on attachment: 288933 Committed
r205953
: <
http://trac.webkit.org/changeset/205953
>
WebKit Commit Bot
Comment 7
2016-09-15 00:23:30 PDT
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 8
2016-09-15 00:42:09 PDT
Thanks for the review. (In reply to
comment #4
)
> Comment on
attachment 288817
[details]
> Adding binding test > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=288817&action=review
> > > Source/WebCore/bindings/js/JSDOMPromise.h:162 > > +template<PromiseFunction promiseFunction, bool canBeCalledInWorker = false> > > The use of a boolean here probably makes this hard to read at call sites. Is > there a better way do this? We can use our typical enum approach, for > example.
Done with a PromiseExecutionScope enum class.
> The "false" here is completely unclear. > > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3414 > > static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredWrapper>&&); > > ${functionReturn} ${functionName}(ExecState* state) > > I’d like to see a blank line between these two lines.
Done
> > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3420 > > static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&& deferredWrapper) > > There is an extra space here after the "&&".
Done
> > LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html:140 > > + testPassed(" navigator.mediaDevices.getUserMedia() rejected with error: " + error); > > Why the leading space here? > > > LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html:143 > > testPassed(" navigator.mediaDevices.getUserMedia({}) rejected with error: " + error); > > Why the leading space here?
Fixed
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