Fix `stalled` events not being dispatched correctly on Firefox for certain WPTs
Categories
(Core :: Audio/Video: Playback, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox149 | --- | fixed |
People
(Reporter: alwu, Assigned: alwu)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
Some WPTs expect a media element to receive a stalled event, but the current test implementations are incorrect and cannot produce the expected results in Firefox. This issue affects tests such as:
media-loading-state.htmlmedia-loading-state-timing.sub.htmlmedia-loading-pseudo-classes-in-has.html
We should fix those wpt and ensure the solution remains compatible with other brows
| Assignee | ||
Comment 1•1 month ago
|
||
Reduce the initial data burst sent by stall-resume.py from ~156KB
(file_size / 30) to 4096 bytes. Browsers apply preload heuristics and
stop requesting more data from the server once they have buffered enough
to satisfy those heuristics. If the initial burst is too large, the browser
suspends the channel before entering the stall condition, so the stalled
event never fires. Keeping the initial burst small ensures browsers stay in
the loading state and trigger the stalled event after the expected timeout.
| Assignee | ||
Comment 2•1 month ago
|
||
The previous tests used a trickle pipe URL to trigger the stalled event,
which was unreliable and caused timeouts. This patch switches the tests to
use stall-resume.py, which sends an initial burst of data then stalls
indefinitely until a POST request resumes delivery. This approach works
reliably across all major browsers (Firefox, Chrome, Safari) that dispatch
the stalled event after a period without new data during active playback.
The test files are also renamed from .html to .sub.html to enable WPT
server-side substitution, which allows {{uuid()}} to generate a unique
stash key per test run without requiring JavaScript UUID generation or a
secure context.
| Assignee | ||
Comment 3•1 month ago
|
||
Remove the TIMEOUT/NOTRUN expectations from the INI files now that the tests
pass reliably. The invalidation test retains the
dom.media.pseudo-classes.enabled pref since that feature is still behind a
flag in Firefox.
| Assignee | ||
Comment 4•1 month ago
|
||
:stalled requires readyState <= HAVE_CURRENT_DATA (indicated by the waiting
event) and networkState == NETWORK_LOADING in a stalled state (indicated by
the stalled event, which fires after is currently stalled is set per
https://github.com/whatwg/html/pull/11959). The original test only checked
:stalled in the stalled event handler, where readyState may still be
HAVE_FUTURE_DATA if the browser buffered ahead, causing the assertion to fail.
Fix by awaiting both events with Promise.all before asserting :stalled, and
update the post-resume check to use timeupdate instead of progress.
Updated•1 month ago
|
Updated•1 month ago
|
Comment 7•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8d3baf8da8f9
https://hg.mozilla.org/mozilla-central/rev/c22c18a22db7
https://hg.mozilla.org/mozilla-central/rev/6ed5c77ff4f8
Updated•1 month ago
|
Description
•