RESOLVED FIXED 145164
AudioContext suspend/resume/close should resolve promises immediately when state is already suspended/active/closed
https://bugs.webkit.org/show_bug.cgi?id=145164
Summary AudioContext suspend/resume/close should resolve promises immediately when st...
youenn fablet
Reported 2015-05-19 01:55:37 PDT
This is a split from https://bugs.webkit.org/show_bug.cgi?id=145064. AudioContext suspend/resume/close methods return promises. In some cases, they can immediately resolve/reject promises. The current implementation is doing the resolve/reject of promises asynchronously using postTask. This may cause some inconsistencies in the order which promises callbacks are actually executed.
Attachments
Patch (5.51 KB, patch)
2015-05-19 02:30 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2015-05-19 02:30:02 PDT
youenn fablet
Comment 2 2015-05-19 04:52:17 PDT
Comment on attachment 253376 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=253376&action=review > Source/WebCore/ChangeLog:8 > + Test: webaudio/audiocontext-promise.html Tried this test on Google Chrome and it actually fails. It seems that pure JS promise callbacks are resolved first in Chrome. I did a test mixing AudioContext and ReadableStreamReader promises on WebKit. As expected, the execution order does not seem right, AudioContext callbacks being always called after ReadableStream callbacks. We should be consistent in our various promise-based APIs, at least align ReadableStream and AudioContext.
Jer Noble
Comment 3 2015-05-19 08:16:20 PDT
The spec is actually ambiguous on a couple of these cases. And even the meaning of "immediately" is ambiguous. We should push the WG to adopt unambiguous language, e.g. resume(): "If the context is already running, return a resolved promise().", "If the context is closed, return a rejected promise().", etc.
Jer Noble
Comment 4 2015-05-19 08:28:10 PDT
youenn fablet
Comment 5 2015-05-19 08:30:37 PDT
(In reply to comment #4) > I filed a spec bug: <https://github.com/WebAudio/web-audio-api/issues/535> Great! Let's continue the discussion there.
Darin Adler
Comment 6 2015-05-19 09:16:39 PDT
My review on the other bug does not mean I approve this change. It’s Jer and Sam who should be discussing this change to how promises work with audio in a WebKit context. I don’t know enough about it.
youenn fablet
Comment 7 2015-05-20 09:50:03 PDT
It seems the discussion in https://github.com/WebAudio/web-audio-api/issues/535 is converging towards making the change. Time to review the patch?
Jer Noble
Comment 8 2015-05-20 09:50:41 PDT
Comment on attachment 253376 [details] Patch Yes indeed. r=me.
WebKit Commit Bot
Comment 9 2015-05-20 10:02:33 PDT
Comment on attachment 253376 [details] Patch Clearing flags on attachment: 253376 Committed r184641: <http://trac.webkit.org/changeset/184641>
WebKit Commit Bot
Comment 10 2015-05-20 10:02:39 PDT
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.