Repository navigation
Conversation
|
For some reasons, I couldn't run a manual test case as described by @webbedspace in the issue description. Got this error; I'm running on Ubuntu 24.04 LTS |
|
|
||
| /// <https://webaudio.github.io/web-audio-api/#unloading-a-document> | ||
| /// Audio contexts that need to be closed when the document unloads. | ||
| audio_contexts: DomRefCell<FxHashSet<Dom<BaseAudioContext>>>, |
There was a problem hiding this comment.
I would expect to see spec text steps in this implementation ?
2.9. Unloading a document
Additional unloading document cleanup steps are defined for documents that use BaseAudioContext:
Reject all the promises of [[pending promises]] with InvalidStateError, for each AudioContext and OfflineAudioContext whose relevant global object is the same as the document’s associated Window.
Stop all decoding threads.
Queue a control message to close() the AudioContext or OfflineAudioContext.
There was a problem hiding this comment.
Thanks ser
Will add them spec steps now.
6ead77d to
5655923
Compare
f478ca0 to
deaa8d0
Compare
This error is mostly irrelevant. The given page should produce audio regardless of this. |
I'm not sure why it wasn't producing the sound. I even tried a custom test file with sound. |
|
So I've been able to detect why this wasn't working on my machine: the sounds was not playing because So I tried writing a new file to test this: And it's working - closing the tab stops the sound comlpletly. |
…load and tab close Signed-off-by: Sabb <[email protected]>
Signed-off-by: Sabb <[email protected]>
deaa8d0 to
049066c
Compare
| document.clean_up_media_elements(cx.no_gc()); | ||
| document.clean_up_audio_contexts(cx); |
There was a problem hiding this comment.
I think this needs to be after
where we already do this. It would be surprising to me if we don't call these steps when we exit a pipeline.I think the call stack should be:
- https://html.spec.whatwg.org/multipage/speculative-loading.html#nav-traversal-ui:close-a-top-level-traversable
- https://html.spec.whatwg.org/multipage/document-sequences.html#garbage-collection-and-browsing-contexts:definitely-close-a-top-level-traversable
- https://html.spec.whatwg.org/multipage/document-sequences.html#garbage-collection-and-browsing-contexts:unload-a-document-and-its-descendants
Basically instead of the code you have here, we should call document.close which would then call document.definitely_close. That said, I don't actually know how much would break if we were to do that.
Let me make a separate PR to make these changes and see what the damage is.
There was a problem hiding this comment.
#50097 but it doesn't work, so I asked for guidance.
Transitioned the GStreamer audio sink pipeline to
State::Nullon drop to terminate GStreamer background streaming threads. Allowed tracking of activeBaseAudioContextinstances on Document and close them during unloading document cleanup steps.Now cleans up active media elements and audio contexts when a pipeline exits in
ScriptThread::handle_exit_pipeline_msg.Added a test to ensure
AudioContextis closed on document unload and that it does not leak the document.Testing:
./mach test-wpt tests/wpt/mozilla/tests/memory/audiocontext_closed_on_unload.htmlpassed cleanly w/Fixes: #49450