Port BaseAudioContext to the HTML event loop.
Created attachment 408377 [details] Patch
Created attachment 408389 [details] Patch
Created attachment 408392 [details] Patch
Created attachment 408394 [details] Patch
Created attachment 408449 [details] Patch
Comment on attachment 408449 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=408449&action=review > LayoutTests/webaudio/audiocontext-state-interrupted.html:74 > + setTimeout(function() { > + debug(''); > + debug('Test 2: resume() while interrupted will cause interruption to end.') > > - context.onstatechange = secondInterruptionStarted; > - if (window.internals) > - evalAndLog('internals.beginMediaSessionInterruption("System")'); > + context.onstatechange = secondInterruptionStarted; > + if (window.internals) > + evalAndLog('internals.beginMediaSessionInterruption("System")'); > + }, 0); It would be good to have a LayoutTests ChangeLog explaining why these changes are necessary.
(In reply to Eric Carlson from comment #6) > Comment on attachment 408449 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=408449&action=review > > > LayoutTests/webaudio/audiocontext-state-interrupted.html:74 > > + setTimeout(function() { > > + debug(''); > > + debug('Test 2: resume() while interrupted will cause interruption to end.') > > > > - context.onstatechange = secondInterruptionStarted; > > - if (window.internals) > > - evalAndLog('internals.beginMediaSessionInterruption("System")'); > > + context.onstatechange = secondInterruptionStarted; > > + if (window.internals) > > + evalAndLog('internals.beginMediaSessionInterruption("System")'); > > + }, 0); > > It would be good to have a LayoutTests ChangeLog explaining why these > changes are necessary. Yes. Basically the issue is we sometimes move to on test to another based a Promise resolution (e.g. context.resume() / context.suspend() return promises). The promise gets resolved *BEFORE* the statechange event gets fired, as per spec. The setTimeout(0) makes sure any pending statechange event has been fired before we move on to the next text (because the next test may rely on the statechange event and we don't want it to receive the event from the previous test).
Created attachment 408450 [details] Patch
Committed r266835: <https://trac.webkit.org/changeset/266835> All reviewed patches have been landed. Closing bug and clearing flags on attachment 408450 [details].
<rdar://problem/68650688>