You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
media elements must not be freed while they are playing #48833
Media elements must not stop playing just because all references to them have been removed; only once a media element is in a state where no further audio could ever be played by that element may the element be garbage collected.
The main idea here is to add a field to HTMLMediaElement of DomRefCell<Option<Trusted<HTMLMediaElement>>>, which will create a GC cycle and ensure that the element can't be GCed. The trickier bit is figuring when we need to set that field to non-null and when we need to set it to null in order to avoid leaking media elements forever. This matters both for when playback is paused/stopped, but also if the document is unloaded.
Activity
jdm commentedon Oct 16, 2026
The main idea here is to add a field to HTMLMediaElement of
DomRefCell<Option<Trusted<HTMLMediaElement>>>, which will create a GC cycle and ensure that the element can't be GCed. The trickier bit is figuring when we need to set that field to non-null and when we need to set it to null in order to avoid leaking media elements forever. This matters both for when playback is paused/stopped, but also if the document is unloaded.sabbCodes commentedon Oct 16, 2026
I'd like to attempt this.
sabbCodes commentedon Oct 16, 2026
So after few hours of research, I found out that
/components/script/dom/abort/abortsignal.rshas similar fix, trying to implement it.script: Prevent media elements from being GCed while playing (servo#4…