Repository navigation
script: reduce the size of DOM elements - #48082
Merged
Merged
Conversation
sagudev
reviewed
Sep 15, 2026
Contributor
|
Can you also run padlock-cli (https://github.com/gidotencate/padlock/tree/main/crates/padlock-cli) on the changed structs, to see if we can compact them more via reordering? |
jdm
requested changes
Oct 1, 2026
jdm
left a comment
Member
There was a problem hiding this comment.
This looks fine, but it would be good to set a limit on the new cache.
- move 'is' value to the rare data struct. - use a thread local cache for local names. Signed-off-by: webbeef <[email protected]>
Contributor
|
Sorry to be nitpicky but did you try |
jdm
approved these changes
Oct 15, 2026
Contributor
Author
So is |
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
Nothing kept a media element alive while it loaded or played: the player only holds a weak reference to it. An element that script no longer referenced was collected at the next garbage collection, which stopped its playback, and a detached element that delayed the load event let the load event fire early. The specification requires that "media elements must not stop playing just because all references to them have been removed". Like Gecko, and Blink apart from autoplay, keep a media element alive while it delays the load event or seeks, and, until it has ended playback, while it plays or waits for data to play or is eligible for autoplay. Its owner document holds such elements, so they never outlive the document. Fork note: meant for upstream; found with the QuickJS backend, which frees such elements as soon as script drops them (the media tests have failed on QuickJS since patch 61's pool scopes), but SpiderMonkey loses them too once a GC runs (the new test times out without this change). Besides the upstream change, this drops the QuickJS conditions in the expectations of autoplay-disabled-by-permissions-policy; patch 72 drops the others. Drop once upstream has it. Testing: Adds a WPT test that unreferenced media elements keep playing across a garbage collection; it times out without this change. Validation: Release builds of upstream f040186 with SpiderMonkey, with and without the series, `./mach test-wpt --processes 4` of html/semantics/embedded-content/media-elements, the-video-element, the-audio-element, infrastructure/assumptions/allowed-to-play.html, webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface and 2 _mozilla media tests: the new test passes 7 of 7 (harness timeout without), autoplay-disabled-by-permissions-policy and played-loop as in the updated expectations (autoplay-disabled timed out intermittently before, upstream issues servo#46012 and servo#46804); the remaining differences are track timeouts and track-cues-sorted-before-dispatch failures that both builds show intermittently, and one seek-to-max-value failure in 7 runs with the series (`currentTime` 0 right after setting it), not reproduced in 6 reruns, apart from load-removes-queued-error-event, which now hangs whenever GStreamer 1.24.2's playbin3 stalls on a `<video>` with an audio-only MP3: 4 of 6 runs on this host without the series too; the stalled element delays the load event, and before, only a garbage collection that freed it let the load event fire (upstream's intermittent tracker has 9 unexpected results for that test in total). The three tests that fail on QuickJS CI pass with forced GCs every 20 ms too. With logging of the keep-alive updates, every element in direct checks stopped being kept alive once it had been loaded and never played, played to the end, paused, replayed after the end without a seekable range, or played backwards to the start. An independent agent review found no blockers; its two should-fix findings for this patch (ended but unpaused elements were kept alive; changes of the error went through no hook) are fixed. QuickJS release build of this stack: the new tests and the media tests that had QuickJS expectations (autoplay.html, allowed-to-play.html, resource-selection-candidate-moved.html and the three autoplay permissions policy tests) give SpiderMonkey's results in 2 of 2 runs; without the series they time out as the dropped expectations said. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `HTMLMediaElement` import next to upstream's `TracedScriptResult` (servo#48855), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new sizes (servo#48082)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
…ested The resource fetch algorithm suspended the fetch for preload=none only when the can-autoplay flag was false, which is the case once play() or pause() ran before resource selection, and nothing ever resumed it. So preload=none was ignored while the element was not asked to play, and an element that was asked to play, e.g. with `src`, `load()` and `play()`, never loaded or played. Like Gecko and Blink, suspend the fetch for preload=none only while the element is paused, has no autoplay attribute and is not loading through an explicit `load()`, and never for a blob URL, which is a local resource. Suspend before creating a media player. Resume, with steps 5.remote.1.5 to 5.remote.1.7 and after the task that stops delaying the load event, when `play()` is called, the autoplay attribute is set, or the preload attribute changes to another state. As in other browsers, a `<video preload=none>` that is not playing no longer fetches its metadata, so it has no natural size until it plays. Fork note: meant for upstream, with the three patches before (it uses patch 69's network-state setter). Drop once upstream has it. Testing: Adds a WPT test that play() plays a media element with preload=none, also with source elements; three of its six subtests time out without this change. Validation: Release builds of upstream f040186 with the series, against the same build without this patch, a direct check of preload=none cases: `play()` right after setting `src`, after `load()`, and after `pause()` now load and play (before, `readyState` stayed 0 and the `play()` promise never settled); without a request to play, the element now stays at NETWORK_IDLE and HAVE_NOTHING instead of downloading the resource; `play()`, setting `preload` to auto and setting the autoplay attribute resume the load; `load()` alone, the autoplay attribute, blob URLs and `load()` with a first source element that is unsupported or fails still load right away; `load()` followed by a `src` change suspends (like Blink); setting `currentTime` while suspended doesn't resume. The new test: 3 of 6 subtests time out without this patch, 6 of 6 pass with it (3 runs), and chrome-headless-shell 154 passes 6 of 6. `./mach test-wpt --processes 4` of the same 461 media tests as for the previous patches: only the new test changes, apart from tests that are intermittent with both builds. Unreferenced preload=none elements with `play()` now play to the end and are collected afterwards (before, they never played and were kept alive). Two rounds of independent agent review; all should-fix findings are fixed (explicit `load()` now covers every source candidate of the resource selection, blob URLs are never suspended, a resume before the stop-delaying task waits for it, so `suspend` sees NETWORK_IDLE); not done: gating the autoplay override on the sandboxed automatic features flag, whose only effect is an extra fetch. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
…eeking When the player has enough data, the media element cancels a seekable fetch, and restarts it once the player asks for data again. It did not know which byte the player expected next, so it restarted by seeking the element to the current playback position. That queued seeking and seeked events that the page never asked for, and made GStreamer flush its pipeline and download again the data that it had already buffered. When the media resource has no seekable range, for example while its duration is unknown, the seek did nothing and playback stalled. Track the offset of the next byte that the player has not accepted: the start of the fetch plus the bytes that the player took, without a chunk that it refused because it has enough data. Restart the fetch at that offset, without a seek, and let the new fetch push its data right away, since the player already asked for it. GStreamer's source only asks for a new fetch when the pipeline seeks to an offset other than its own, and its offset moves by the same bytes, so the restarted fetch simply continues its stream. (A seek that the source declined reset its offset to 0; a later patch fixes that.) Cancel on the EnoughData event only once the next chunk arrives, rather than at once, and ignore empty chunks, like the last frame of an HTTP/2 body, so that a fetch that already delivered all of its bytes is never restarted at the end of the resource, where the server would answer with an error. The fetch context now keeps that position and whether the player has enough data, which grows HTMLVideoElement from 1248 to 1256 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: headless release builds for Linux (GStreamer 1.24) of ohos-main 02ebe64 with and without this patch, playing a 40 s, 149.7 MB H.264 MP4 (30 Mbit/s, moov first) to its end in a muted `<video preload=metadata>`, which keeps GStreamer's download buffering off so that its 50 MiB source queue fills up. From a local server with range support: without this patch, 3 requests and 223.0 MB sent, restarted after seeking and seeked events at 13 s and 27 s; with it, 3 requests restarting at the byte offsets 72.6 MB and 125.6 MB, 165.5 MB sent (the excess is the bytes in flight when a fetch was cancelled), and no seeking event. On the first version of this patch, before review fixes that do not touch this path, a trace of GStreamer's source showed its offset reaching exactly each restart offset and never going back, appsrc seeking only once, to 0, at startup, and an `<audio>` element playing the same video-only file, whose duration is reported as infinite, play all 40 s in 3 requests, where it stalls at 19.3 s after one request without this patch. Without range support: 3 requests from byte 0 either way (373.0 MB without, 375.0 MB with this patch), but no seeking event with it. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with this patch and with an ohos-main build: no new failure. Its unexpected results either also occur without this patch (media_fragment_seek fails in 3 of 3 isolated runs either way, autoplay-default-permissions-policy, the mp4 subtest of video_timeupdate_on_seek passing in 1 of 5 isolated runs without it) or did not repeat in 3 isolated runs (gc-unreferenced-media-element). `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the empty-chunk check under upstream's new `process_response_chunk` signature with a `&GlobalScope` (51d1117, servo#49032), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
…ayer is full When the player refused a chunk because it had enough data, the media element cancelled the fetch, even when the server does not support range requests. Every restart of such a fetch downloads the resource from its start again and discards the bytes before the restart offset. The refused chunk itself was dropped as well. Keep a refused chunk at the front of the queue, so that the player gets it once it asks for data again. If the fetch is not seekable, do not cancel it: lock the queue instead, keep queueing the chunks that follow, and push them once the player sends NeedData. A seekable fetch is still cancelled, and restarts at its first refused byte. Until net can suspend and resume a fetch, cap the queue at 32 MiB. Once more is queued, cancel the fetch like a seekable one, and restart it at the first byte that the player has not accepted once the player needs data again. Without range support, that restart downloads the resource from its start again and discards the bytes before that offset, as every restart did before. A restart cannot tell a live stream from a finite resource of unknown length, and keeping the bytes of a finite one would feed its start to the demuxer again, so a live stream without range support discards as many new bytes as the player had taken: after a pause long enough to reach the cap, it stalls for about as long as it had played. Below the cap, a resource is downloaded once. The OpenHarmony backend never refuses pushed data, so this does not change it. Counting the queued bytes grows HTMLVideoElement from 1256 to 1264 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: the setup of the previous patch. Without range support, the 149.7 MB file needs 2 requests and 266.7 MB, instead of 3 requests from byte 0 and 375.0 MB with the previous patch alone (373.0 MB on ohos-main): the first fetch is cancelled once 32 MiB are queued behind GStreamer's full queue, and the restart downloads the rest. Peak RSS of servoshell 429 MiB, against 407 MiB with the previous patch alone; without the cap, the whole file was downloaded once, at a peak of 464 MiB. Pausing that video for 25 s after 3 s: 2 requests, 265.1 MB and a peak of 430 MiB, against 1 request and 462 MiB without the cap, and 3 requests, 380.4 MB, two seeking events and 406 MiB on ohos-main. With range support, unchanged: 3 requests restarting at byte offsets, 169.0 MB, no seeking event. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with the series up to the last patch and with an ohos-main build: no new failure; the unexpected results (media_fragment_seek, autoplay-default-permissions-policy, load-removes-queued-error-event) also occur on ohos-main. On the first version of this patch, without the cap, track-cues-sorted-before-dispatch failed in 2 of 20 isolated runs and track-remove-by-setting-innerHTML timed out in 1 of 10, as on ohos-main. Re-run with the whole series after the second review: the range case takes 3 requests and 163.2 MB with no seeking event, and the paused case 2 requests, 266.5 MB and a peak of 426 MiB; `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of media-elements, the-video-element and drawing-images-to-the-canvas (449 tests): no new failure; track-cues-seeking timed out in 1 of 13 isolated runs both with the series and on ohos-main, and video_loop_base passed 3 of 3 isolated runs either way. After the restart without discarding was reverted, the paused case takes 2 requests, 260.2 MB and a peak of 430 MiB. `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
…r is full When its player has enough data, a media element cancels a fetch with range support, to restart it with a Range request once the player needs data again, and keeps queueing the data of a fetch without range support, up to 32 MiB, before it cancels it and fetches the resource from its start again. Every restart costs a request, on HTTP/1.1 a new connection, and the bytes that were in flight. Ask net to suspend a fetch that is read from the network instead, and queue the data that was in flight. Net answers whether it suspended the fetch. If it did, flow control holds back the server, the download is suspended (NETWORK_IDLE and suspend, then NETWORK_LOADING once it resumes, and no progress events meanwhile), and once the player needs data, the same fetch resumes and the queue drains. If it did not, as for a cache hit or when two fetches to the origin are suspended already, the fetch backs off as before; so it does if the answer is lost, and it is resumed in case net suspended it. Responses that are not read from the network are handled as before, and the cap on the queue stays for data that keeps arriving. When a fetch completes, progress, then NETWORK_IDLE and suspend follow, also if the fetch was suspended. A fetch with range support that stays suspended for media_fetch_suspension_timeout_ms (30 s) is cancelled, to restart where the player stopped once it needs data again, so that an element paused for long does not hold a connection, which servers would time out anyway. A fetch without range support stays suspended, since its restart would fetch the resource from its start again, until net gives up on it after network_fetch_suspend_timeout_ms (60 s). Such a server, and net, end the fetch: net with a network error, which ran the fatal steps (MEDIA_ERR_NETWORK, "If the connection is interrupted after some media data has been received"), and a closed connection like a complete body, so the stream ended early. So if a fetch that was suspended ends with a network error, or with fewer bytes than its Content-Length, restart it at the byte where the player stopped, with a Range request, which a server without range support answers from the start of the resource, whose bytes before that position are discarded as after a seek: at once if the player accepts data, or else once it needs data again. A restart past the end of the resource, which the server answers with 416 or which the length of the resource tells, ends the stream, as when the server's Content-Length was too large; so does a restart without range support whose body ends without an error where the player stopped. Any other restart that ends early before it delivers data runs the fatal steps: net ends a body that loses its connection without an error. A restart that delivered data may be restarted again, so a fetch is only restarted while it makes progress. The Content-Length of an encoded body is not the length of the decoded body, so it is not compared. The state of the suspension in the fetch context grows HTMLVideoElement from 1264 to 1296 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; a fetch only backs off once the 50 MiB queue of the GStreamer player is full. See Validation. Validation: Linux, GStreamer, a 150 MB, 40 s H.264 file in a muted <video preload=metadata> that plays, from a Python server that sends at most 25 MB/s per connection; the base is the parent commit. With range support: 1 request and 149.7 MB sent (base: 3 requests, 149.9 MB); networkState turns NETWORK_IDLE with a suspend event once net confirms the suspension 3.5 s in, and NETWORK_LOADING when the fetch resumes 17.4 s in, with no seeking, stalled or error event. Without range support: 1 request, 149.7 MB, peak RSS 422 MiB (base: 2 requests, 269.9 MB, 419 MiB); paused for 25 s, 1 request, 149.7 MB (base: 2 requests, 269.9 MB). Paused for 40 s with range support: the timeout cancels the fetch 30 s after the suspension, and the restart when playback needs data again plays to the end: 2 requests, 155.4 MB (base: 3 requests, 149.9 MB). Three elements on one origin: net suspends two fetches, which take 1 request each, and the third backs off when net declines its suspension: 4 requests, 449.1 MB (base: 9 requests, 449.8 MB). A suspension costs peak RSS (423 instead of 392 MiB for one element, 738 instead of 683 MiB for three), although only 53 bytes were queued when net confirmed it: once the fetch resumes, net reads at once what the socket buffers held. A server that closes a connection it could not write to for 5 s: the earlier revision of this patch without the restart ended playback after 16.5 s of the media, with no error; with it, the media plays to the end, in 3 requests and 149.7 MB with range support and 2 requests and 238.3 MB without. With network_fetch_suspend_timeout_ms=5000 and playback paused for 40 s, net ends the suspended fetch with a network error, and the media plays to the end after the restart: 3 requests and 156.9 MB with range support, 2 requests and 239.1 MB without, no error event. A server whose Content-Length is 10 MB too large: playback ends normally, as on the base; at 25 MB/s the restart fetches the 10.5 MB that were queued again (2 requests, 160.2 MB) and, without range support, the whole resource again (2 requests, 299.3 MB); at 8 and 12 MB/s the restart starts at the end of the file, which the server answers with 416 (2 requests, 149.7 MB). A server that closes idle connections and closes the restart right after its headers: MEDIA_ERR_NETWORK at the restart, 16.5 s into the media, with and without range support. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` html/semantics/embedded-content/media-elements, the-video-element and html/canvas/element/manual/drawing-images-to-the-canvas with the series: 451 tests, 446 as expected; the other five behave the same on the parent commit of the series when run alone: autoplay-default-permissions-policy.https.sub.html passes where a timeout is expected (3/3 on both), media_fragment_seek.html fails a subtest (3/3 on both), src_object_blob.html times out 1 of 3 runs on both, video_timeupdate_on_seek.html passes a subtest that is expected to time out, and load-removes-queued-error-event.html hangs intermittently because GStreamer never reports the metadata of the 539-byte sound_0.mp3 (3 of 8 runs with the series, 4 of 8 without, alternating). In a later run of media-elements, track-cues-seeking.html timed out, which it does intermittently with and without the series (3 of 39 and 2 of 39 isolated runs, alternating); its 192 KB video never fills the player. `./mach check --ohos` passes at each commit; `./mach test-tidy` reports only the known rustls advisories. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `media_fetch_suspension_timeout_ms` pref where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915), and the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-22 sync -- compile fix folded in: the two early returns for a fetch that ended early pass the fetch listener's global to `submit_timing`, which takes it since upstream 51d1117 (servo#49032)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
A media element fetched its media resource itself and pushed each chunk into the player as it arrived. To keep the player from being flooded, it backed off, suspended the fetch, cancelled it after a timeout, and restarted it where the player had stopped, after a lost connection, a 416 or a seek, with a cap on the bytes it queued and a document registry to cancel suspended fetches that nothing would resume. A loop on a backend without its own buffer, a second element and a reload of the same resource downloaded it again. In the resource fetch algorithm, the element now opens a reader of the media resource in the media cache of the content process instead, keyed by the requested URL, the CORS mode and the origin of the document, with a ScriptFetcher for the fetches that the cache needs. Blob and data URLs take the same path; MediaStream sources are unchanged, and preload=none still opens no reader until the media resource is needed. If the player accepts the reader as its data source, it reads from it. Otherwise the element pushes the data of the reader into the player: once the player needs data, it reads 64 KiB chunks from the byte where the player stopped and pushes them until the player has enough, when the refused chunk is read again later, or until the reader has no data there yet, when the waker of the reader continues; at most 1 MiB per task, so that cached data does not block the script thread. SeekData moves that position, and the end of the stream reaches the player as such. The resource is keyed on its URL without the fragment, so that `a.mp4#t=10` and `a.mp4` share it. The internal blob URL of a srcObject Blob is revoked once the fetcher has claimed the blob. The events of the reader map onto the media element: - The metadata of the resource sets the input size and seekability of the player, before the first data and only then, with the size first, since the OpenHarmony player reads both once. The reader reports the metadata again once it learns the length of a resource of unknown length, which the player learns as well. A CORS-cross-origin response makes the media data not origin-clean until the resource fetch algorithm runs again, as before. - Progress, which the reader reports at most every 350 ms, fires a progress event while the download is not suspended. - A suspended download sets the networkState to NETWORK_IDLE and fires suspend, and a resumed one sets it back to NETWORK_LOADING. When the download is suspended for preload=metadata, before playback was requested, the element stops delaying the load event, as the spec asks for a download suspended until the user starts playback. - Once the whole resource is cached, progress, NETWORK_IDLE and suspend follow. - An error before the media engine has the metadata runs the media data processing failure steps, which try the next source, and later, or for a resource that changed between two responses, the fatal steps with MEDIA_ERR_NETWORK, as other browsers do. So does the failure of the first fetch of the element's fetcher. The element tells the reader what it needs: playback at the bitrate of the resource, its length divided by its duration once both are known, while it plays; only the metadata for preload=metadata until playback is requested, unless it autoplays; and otherwise, as while its document is not fully active, what a paused reader keeps. Its reader is closed, also for a player that still holds it, so that the player's reads fail and the fetch stops, by the load algorithm, before the next source, by the failure and fatal steps, when the player goes away, and when its document is unloaded for good or its pipeline exits; documents keep weak references to the media elements that opened a reader for that and for their activity, and an adopted element moves to its new document. While it downloads with a reader, the element has pending activity, which the fetch listener provided before. The cache now owns what the element did for fetches, which goes: BufferedDataSource apart from the position of the push adapter, HTMLMediaElementFetchContext, the fetch listener of the media data, backing off, suspension and its timeout with the pref media_fetch_suspension_timeout_ms, the restarts, the handling of 416, the queue cap and the document registry of suspended fetches. The blob URL that the element kept for the fetches it restarted itself, for a Blob assigned to srcObject, goes too, since nothing reads it any more. Media fetches are no longer in the fetch group of the document. A navigation away from a document with a media download in progress still cancels it, since that makes the document unsalvageable, so that its unloading closes the readers; window.stop() and document.open() no longer cancel media downloads. Fork note: meant for upstream. Drop once upstream has it. Testing: the new mozilla/media-blob-url-revoked-seek.html seeks far into a blob after its URL was revoked (passes 5 of 5; phase 1 fails 5 of 5). fetch/range/non-matching-range-response.html now passes "Range response out of range of request should succeed", and html/browsers/browsing-the-web/read-media/cross-origin-video.html, whose server answers in parts, now plays (3 of 3 runs, 3 of 3 failures with phase 1); their expectations go; the other media, canvas and range tests cover the rest. See Validation for the scenarios that no WPT test covers. Validation: Linux host release builds with GStreamer, against the phase 1 build of ohos-main. `./mach test-wpt --release --timeout-multiplier 2` of html/semantics/embedded-content/media-elements, the-video-element, html/canvas/element/manual/drawing-images-to-the-canvas and imagebitmap (with drawimage_video_crossorigin_seek.sub.html), fetch/range and mozilla/media-autoplay-seek-after-ended.html, 493 tests: apart from the fixed range test, every unexpected result also occurs with the phase 1 build in isolated runs: load-removes-queued-error-event hangs while GStreamer never reports the metadata of the 539-byte sound_0.mp3 (also outside WPT: 8 of 12 runs here, 6 of 12 there), src_object_blob times out (2 of 16 and 3 of 16), seek-to-max-value fails (0 of 3 and 1 of 3), media_fragment_seek fails (3 of 3 either way), and autoplay-default-permissions-policy passes where a timeout is expected; track-cues-seeking, track-mode-disabled and video_loop_base passed 3 of 3 isolated runs on both. Scenarios with a 14 MB, 30 s H.264 file from a local server, requests and MB sent, with and without range support: play 2 / 14.3 and 1 / 14.3 (phase 1: 3 / 26.6 and 3 / 41.6), loop 2 / 14.3 and 1 / 14.3 (3 / 26.1 and 8 / 83.3), seek back 2 / 14.3 and 1 / 14.3 (3 / 25.9 and 3 / 40.1), two elements 2 / 14.3 and 1 / 14.3 (16 / 76.4 and 6 / 85.6), reload 2 / 14.3 and 1 / 14.3 (9 / 77.5 and 9 / 115.7), play again after the end 2 / 14.3 and 1 / 14.3 (3 / 26.0 and 3 / 40.9); the second request with range support reads the last 40 KB, and a loop, a seek back, a second element and a reload need no request. A 150 MB, 40 s file with preload=metadata at full speed: 1 request and 149.7 MB with and without range support (2 / 217.3 and 2 / 272.8); at 25 MB/s, two elements 2 and 1 requests for 149.7 MB (10 requests, 299.7 and 823.8 MB) and a pause of 40 s 1 request (2 / 155.4 with range support). Peak RSS is lower in every scenario, for example 397 instead of 418 MiB for the reload. At 5 MB/s, load() with another source 6 s in and a navigation away close the connection at 6.0 s, as with phase 1; a paused element removed from its document loads up to the read-ahead of a paused reader in the cache, here the whole file, where phase 1 closed the connection after 17 to 24 s. `./mach check` and `./mach check --ohos` pass; `./mach test-unit size_of` passes with HTMLVideoElement down from 1296 to 1200 bytes; `./mach test-tidy` reports only the known rustls advisories. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- conflict resolution: the fetch listener this patch removes had upstream's new listener signatures (51d1117, servo#49032) and `LocalName` initiator type (servo#48953), which the fetcher of patch 99 now uses; imports merged next to upstream's `AtomicRefCell` (servo#49087) and `TracedScriptResult` (servo#48855); the patch's -96 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082). `./mach check` passes at this commit) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 22, 2026
The state of the reader of the media cache, with that of the push adapter and the stall timer, made every media element larger, also the many that never load a resource. Keep it in a Box, which takes HTMLVideoElement from 1224 to 1136 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: `./mach test-unit size_of`. Validation: `./mach test-unit size_of` passes. AI-assisted: Yes (agent session; implemented by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
Upstream servo#48979 keeps a media element alive through its owner document while it plays or is eligible for autoplay, and servo#49367 lets it go after it has ended. An element that delays the load event or seeks is still collected at the next garbage collection once script drops it, which stops it and lets the load event fire early, and the keep-alive is only updated at a few points of the media element's algorithms. Like Gecko, and Blink apart from autoplay, also keep a media element alive while it delays the load event and, with a resource and no error, while it seeks. Don't keep an element without a resource alive, and keep one that is eligible for autoplay only until it has enough data: then it either plays or never will. Update the keep-alive whenever the network state, paused, seeking, the can autoplay flag, the error, the ready state or the delaying-the-load-event flag changes. Fork note: meant for upstream; found with the QuickJS backend, which frees such elements as soon as script drops them, but SpiderMonkey loses them too once a GC runs. Until the 2026-10-29 sync this patch had its own keep-alive set; it now extends upstream's. Besides the upstream change, this drops the QuickJS conditions in the expectations of autoplay-disabled-by-permissions-policy; patch 49 dropped the others. Drop once upstream has it. Testing: Adds a WPT test that unreferenced media elements keep playing across a garbage collection. Validation: Release builds of upstream f040186 with SpiderMonkey, with and without the series, `./mach test-wpt --processes 4` of html/semantics/embedded-content/media-elements, the-video-element, the-audio-element, infrastructure/assumptions/allowed-to-play.html, webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface and 2 _mozilla media tests: the new test passes 7 of 7 (harness timeout without), autoplay-disabled-by-permissions-policy and played-loop as in the updated expectations (autoplay-disabled timed out intermittently before, upstream issues servo#46012 and servo#46804); the remaining differences are track timeouts and track-cues-sorted-before-dispatch failures that both builds show intermittently, and one seek-to-max-value failure in 7 runs with the series (`currentTime` 0 right after setting it), not reproduced in 6 reruns, apart from load-removes-queued-error-event, which now hangs whenever GStreamer 1.24.2's playbin3 stalls on a `<video>` with an audio-only MP3: 4 of 6 runs on this host without the series too; the stalled element delays the load event, and before, only a garbage collection that freed it let the load event fire (upstream's intermittent tracker has 9 unexpected results for that test in total). The three tests that fail on QuickJS CI pass with forced GCs every 20 ms too. With logging of the keep-alive updates, every element in direct checks stopped being kept alive once it had been loaded and never played, played to the end, paused, replayed after the end without a seekable range, or played backwards to the start. An independent agent review found no blockers; its two should-fix findings for this patch (ended but unpaused elements were kept alive; changes of the error went through no hook) are fixed. QuickJS release build of this stack: the new tests and the media tests that had QuickJS expectations (autoplay.html, allowed-to-play.html, resource-selection-candidate-moved.html and the three autoplay permissions policy tests) give SpiderMonkey's results in 2 of 2 runs; without the series they time out as the dropped expectations said. 2026-10-29 sync, reworked onto upstream's keep-alive: release builds of this sync's stack and of plain upstream ed6a924, `./mach test-wpt --release` of the media-elements, the-video-element and the-audio-element directories with fetch, xhr, eventsource, cors, subresource-integrity, resource-timing, canvas image drawing and _mozilla/memory (2,247 tests), then 3 reruns on both of every test whose results differed: the same results on both except for intermittent ones, gc-unreferenced-media-element and upstream's playing_media_no_gc pass; a playing element's back/forward cache restore fails on both (upstream servo#48979 pauses it at unload). DAYU200 (OpenHarmony 7.0), headless release builds with SpiderMonkey and with QuickJS, `./mach test-wpt --ohos --processes 1 --timeout-multiplier 2` of the media series' tests, loading-the-media-resource, error-codes and playing-the-media-resource (75 tests): all as expected but the two autoplay permissions policy tests that pass where a timeout is expected, on both engines; no crash. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `HTMLMediaElement` import next to upstream's `TracedScriptResult` (servo#48855), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new sizes (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- upstream servo#48979 and servo#49367 landed a keep-alive set of their own: the patch now extends upstream's `should_keep_alive` with its rules (load event delay, seeking, resource and HAVE_ENOUGH_DATA conditions) and keeps its setter hooks; its own set, flag and duplicate hooks are gone, as is its +8 bytes of `HTMLVideoElement`; subject and message rewritten) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
…ested The resource fetch algorithm suspended the fetch for preload=none only when the can-autoplay flag was false, which is the case once play() or pause() ran before resource selection, and nothing ever resumed it. So preload=none was ignored while the element was not asked to play, and an element that was asked to play, e.g. with `src`, `load()` and `play()`, never loaded or played. Like Gecko and Blink, suspend the fetch for preload=none only while the element is paused, has no autoplay attribute and is not loading through an explicit `load()`, and never for a blob URL, which is a local resource. Suspend before creating a media player. Resume, with steps 5.remote.1.5 to 5.remote.1.7 and after the task that stops delaying the load event, when `play()` is called, the autoplay attribute is set, or the preload attribute changes to another state. As in other browsers, a `<video preload=none>` that is not playing no longer fetches its metadata, so it has no natural size until it plays. Fork note: meant for upstream, with the three patches before (it uses patch 69's network-state setter). Drop once upstream has it. Testing: Adds a WPT test that play() plays a media element with preload=none, also with source elements; three of its six subtests time out without this change. Validation: Release builds of upstream f040186 with the series, against the same build without this patch, a direct check of preload=none cases: `play()` right after setting `src`, after `load()`, and after `pause()` now load and play (before, `readyState` stayed 0 and the `play()` promise never settled); without a request to play, the element now stays at NETWORK_IDLE and HAVE_NOTHING instead of downloading the resource; `play()`, setting `preload` to auto and setting the autoplay attribute resume the load; `load()` alone, the autoplay attribute, blob URLs and `load()` with a first source element that is unsupported or fails still load right away; `load()` followed by a `src` change suspends (like Blink); setting `currentTime` while suspended doesn't resume. The new test: 3 of 6 subtests time out without this patch, 6 of 6 pass with it (3 runs), and chrome-headless-shell 154 passes 6 of 6. `./mach test-wpt --processes 4` of the same 461 media tests as for the previous patches: only the new test changes, apart from tests that are intermittent with both builds. Unreferenced preload=none elements with `play()` now play to the end and are collected afterwards (before, they never played and were kept alive). Two rounds of independent agent review; all should-fix findings are fixed (explicit `load()` now covers every source candidate of the resource selection, blob URLs are never suspended, a resume before the stop-delaying task waits for it, so `suspend` sees NETWORK_IDLE); not done: gating the autoplay override on the sandboxed automatic features flag, whose only effect is an extra fetch. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): without patch 65's keep-alive flag, and the `autoplay` attribute arm split out of upstream's `autoplay | loop` arm to resume the suspended load; `HTMLVideoElement` is 1208 bytes, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
…eeking When the player has enough data, the media element cancels a seekable fetch, and restarts it once the player asks for data again. It did not know which byte the player expected next, so it restarted by seeking the element to the current playback position. That queued seeking and seeked events that the page never asked for, and made GStreamer flush its pipeline and download again the data that it had already buffered. When the media resource has no seekable range, for example while its duration is unknown, the seek did nothing and playback stalled. Track the offset of the next byte that the player has not accepted: the start of the fetch plus the bytes that the player took, without a chunk that it refused because it has enough data. Restart the fetch at that offset, without a seek, and let the new fetch push its data right away, since the player already asked for it. GStreamer's source only asks for a new fetch when the pipeline seeks to an offset other than its own, and its offset moves by the same bytes, so the restarted fetch simply continues its stream. (A seek that the source declined reset its offset to 0; a later patch fixes that.) Cancel on the EnoughData event only once the next chunk arrives, rather than at once, and ignore empty chunks, like the last frame of an HTTP/2 body, so that a fetch that already delivered all of its bytes is never restarted at the end of the resource, where the server would answer with an error. The fetch context now keeps that position and whether the player has enough data, which grows HTMLVideoElement from 1248 to 1256 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: headless release builds for Linux (GStreamer 1.24) of ohos-main 02ebe64 with and without this patch, playing a 40 s, 149.7 MB H.264 MP4 (30 Mbit/s, moov first) to its end in a muted `<video preload=metadata>`, which keeps GStreamer's download buffering off so that its 50 MiB source queue fills up. From a local server with range support: without this patch, 3 requests and 223.0 MB sent, restarted after seeking and seeked events at 13 s and 27 s; with it, 3 requests restarting at the byte offsets 72.6 MB and 125.6 MB, 165.5 MB sent (the excess is the bytes in flight when a fetch was cancelled), and no seeking event. On the first version of this patch, before review fixes that do not touch this path, a trace of GStreamer's source showed its offset reaching exactly each restart offset and never going back, appsrc seeking only once, to 0, at startup, and an `<audio>` element playing the same video-only file, whose duration is reported as infinite, play all 40 s in 3 requests, where it stalls at 19.3 s after one request without this patch. Without range support: 3 requests from byte 0 either way (373.0 MB without, 375.0 MB with this patch), but no seeking event with it. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with this patch and with an ohos-main build: no new failure. Its unexpected results either also occur without this patch (media_fragment_seek fails in 3 of 3 isolated runs either way, autoplay-default-permissions-policy, the mp4 subtest of video_timeupdate_on_seek passing in 1 of 5 isolated runs without it) or did not repeat in 3 isolated runs (gc-unreferenced-media-element). `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the empty-chunk check under upstream's new `process_response_chunk` signature with a `&GlobalScope` (51d1117, servo#49032), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1216, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
…ayer is full When the player refused a chunk because it had enough data, the media element cancelled the fetch, even when the server does not support range requests. Every restart of such a fetch downloads the resource from its start again and discards the bytes before the restart offset. The refused chunk itself was dropped as well. Keep a refused chunk at the front of the queue, so that the player gets it once it asks for data again. If the fetch is not seekable, do not cancel it: lock the queue instead, keep queueing the chunks that follow, and push them once the player sends NeedData. A seekable fetch is still cancelled, and restarts at its first refused byte. Until net can suspend and resume a fetch, cap the queue at 32 MiB. Once more is queued, cancel the fetch like a seekable one, and restart it at the first byte that the player has not accepted once the player needs data again. Without range support, that restart downloads the resource from its start again and discards the bytes before that offset, as every restart did before. A restart cannot tell a live stream from a finite resource of unknown length, and keeping the bytes of a finite one would feed its start to the demuxer again, so a live stream without range support discards as many new bytes as the player had taken: after a pause long enough to reach the cap, it stalls for about as long as it had played. Below the cap, a resource is downloaded once. The OpenHarmony backend never refuses pushed data, so this does not change it. Counting the queued bytes grows HTMLVideoElement from 1256 to 1264 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: the setup of the previous patch. Without range support, the 149.7 MB file needs 2 requests and 266.7 MB, instead of 3 requests from byte 0 and 375.0 MB with the previous patch alone (373.0 MB on ohos-main): the first fetch is cancelled once 32 MiB are queued behind GStreamer's full queue, and the restart downloads the rest. Peak RSS of servoshell 429 MiB, against 407 MiB with the previous patch alone; without the cap, the whole file was downloaded once, at a peak of 464 MiB. Pausing that video for 25 s after 3 s: 2 requests, 265.1 MB and a peak of 430 MiB, against 1 request and 462 MiB without the cap, and 3 requests, 380.4 MB, two seeking events and 406 MiB on ohos-main. With range support, unchanged: 3 requests restarting at byte offsets, 169.0 MB, no seeking event. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with the series up to the last patch and with an ohos-main build: no new failure; the unexpected results (media_fragment_seek, autoplay-default-permissions-policy, load-removes-queued-error-event) also occur on ohos-main. On the first version of this patch, without the cap, track-cues-sorted-before-dispatch failed in 2 of 20 isolated runs and track-remove-by-setting-innerHTML timed out in 1 of 10, as on ohos-main. Re-run with the whole series after the second review: the range case takes 3 requests and 163.2 MB with no seeking event, and the paused case 2 requests, 266.5 MB and a peak of 426 MiB; `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of media-elements, the-video-element and drawing-images-to-the-canvas (449 tests): no new failure; track-cues-seeking timed out in 1 of 13 isolated runs both with the series and on ohos-main, and video_loop_base passed 3 of 3 isolated runs either way. After the restart without discarding was reverted, the paused case takes 2 requests, 260.2 MB and a peak of 430 MiB. `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1224, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
…r is full When its player has enough data, a media element cancels a fetch with range support, to restart it with a Range request once the player needs data again, and keeps queueing the data of a fetch without range support, up to 32 MiB, before it cancels it and fetches the resource from its start again. Every restart costs a request, on HTTP/1.1 a new connection, and the bytes that were in flight. Ask net to suspend a fetch that is read from the network instead, and queue the data that was in flight. Net answers whether it suspended the fetch. If it did, flow control holds back the server, the download is suspended (NETWORK_IDLE and suspend, then NETWORK_LOADING once it resumes, and no progress events meanwhile), and once the player needs data, the same fetch resumes and the queue drains. If it did not, as for a cache hit or when two fetches to the origin are suspended already, the fetch backs off as before; so it does if the answer is lost, and it is resumed in case net suspended it. Responses that are not read from the network are handled as before, and the cap on the queue stays for data that keeps arriving. When a fetch completes, progress, then NETWORK_IDLE and suspend follow, also if the fetch was suspended. A fetch with range support that stays suspended for media_fetch_suspension_timeout_ms (30 s) is cancelled, to restart where the player stopped once it needs data again, so that an element paused for long does not hold a connection, which servers would time out anyway. A fetch without range support stays suspended, since its restart would fetch the resource from its start again, until net gives up on it after network_fetch_suspend_timeout_ms (60 s). Such a server, and net, end the fetch: net with a network error, which ran the fatal steps (MEDIA_ERR_NETWORK, "If the connection is interrupted after some media data has been received"), and a closed connection like a complete body, so the stream ended early. So if a fetch that was suspended ends with a network error, or with fewer bytes than its Content-Length, restart it at the byte where the player stopped, with a Range request, which a server without range support answers from the start of the resource, whose bytes before that position are discarded as after a seek: at once if the player accepts data, or else once it needs data again. A restart past the end of the resource, which the server answers with 416 or which the length of the resource tells, ends the stream, as when the server's Content-Length was too large; so does a restart without range support whose body ends without an error where the player stopped. Any other restart that ends early before it delivers data runs the fatal steps: net ends a body that loses its connection without an error. A restart that delivered data may be restarted again, so a fetch is only restarted while it makes progress. The Content-Length of an encoded body is not the length of the decoded body, so it is not compared. The state of the suspension in the fetch context grows HTMLVideoElement from 1264 to 1296 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; a fetch only backs off once the 50 MiB queue of the GStreamer player is full. See Validation. Validation: Linux, GStreamer, a 150 MB, 40 s H.264 file in a muted <video preload=metadata> that plays, from a Python server that sends at most 25 MB/s per connection; the base is the parent commit. With range support: 1 request and 149.7 MB sent (base: 3 requests, 149.9 MB); networkState turns NETWORK_IDLE with a suspend event once net confirms the suspension 3.5 s in, and NETWORK_LOADING when the fetch resumes 17.4 s in, with no seeking, stalled or error event. Without range support: 1 request, 149.7 MB, peak RSS 422 MiB (base: 2 requests, 269.9 MB, 419 MiB); paused for 25 s, 1 request, 149.7 MB (base: 2 requests, 269.9 MB). Paused for 40 s with range support: the timeout cancels the fetch 30 s after the suspension, and the restart when playback needs data again plays to the end: 2 requests, 155.4 MB (base: 3 requests, 149.9 MB). Three elements on one origin: net suspends two fetches, which take 1 request each, and the third backs off when net declines its suspension: 4 requests, 449.1 MB (base: 9 requests, 449.8 MB). A suspension costs peak RSS (423 instead of 392 MiB for one element, 738 instead of 683 MiB for three), although only 53 bytes were queued when net confirmed it: once the fetch resumes, net reads at once what the socket buffers held. A server that closes a connection it could not write to for 5 s: the earlier revision of this patch without the restart ended playback after 16.5 s of the media, with no error; with it, the media plays to the end, in 3 requests and 149.7 MB with range support and 2 requests and 238.3 MB without. With network_fetch_suspend_timeout_ms=5000 and playback paused for 40 s, net ends the suspended fetch with a network error, and the media plays to the end after the restart: 3 requests and 156.9 MB with range support, 2 requests and 239.1 MB without, no error event. A server whose Content-Length is 10 MB too large: playback ends normally, as on the base; at 25 MB/s the restart fetches the 10.5 MB that were queued again (2 requests, 160.2 MB) and, without range support, the whole resource again (2 requests, 299.3 MB); at 8 and 12 MB/s the restart starts at the end of the file, which the server answers with 416 (2 requests, 149.7 MB). A server that closes idle connections and closes the restart right after its headers: MEDIA_ERR_NETWORK at the restart, 16.5 s into the media, with and without range support. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` html/semantics/embedded-content/media-elements, the-video-element and html/canvas/element/manual/drawing-images-to-the-canvas with the series: 451 tests, 446 as expected; the other five behave the same on the parent commit of the series when run alone: autoplay-default-permissions-policy.https.sub.html passes where a timeout is expected (3/3 on both), media_fragment_seek.html fails a subtest (3/3 on both), src_object_blob.html times out 1 of 3 runs on both, video_timeupdate_on_seek.html passes a subtest that is expected to time out, and load-removes-queued-error-event.html hangs intermittently because GStreamer never reports the metadata of the 539-byte sound_0.mp3 (3 of 8 runs with the series, 4 of 8 without, alternating). In a later run of media-elements, track-cues-seeking.html timed out, which it does intermittently with and without the series (3 of 39 and 2 of 39 isolated runs, alternating); its 192 KB video never fills the player. `./mach check --ohos` passes at each commit; `./mach test-tidy` reports only the known rustls advisories. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `media_fetch_suspension_timeout_ms` pref where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915), and the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-22 sync -- compile fix folded in: the two early returns for a fetch that ended early pass the fetch listener's global to `submit_timing`, which takes it since upstream 51d1117 (servo#49032)) AI-assisted: Yes (agent session; 2026-10-29 sync -- mechanical conflict resolution: the pref next to upstream's `mathml_core_enabled` (servo#48631), the origin-clean line in upstream's `CorsStatus` form (servo#48748); `HTMLVideoElement` is 1256 bytes, measured at this commit with a compile-time probe, since patch 65 no longer adds a field) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
A media element fetched its media resource itself and pushed each chunk into the player as it arrived. To keep the player from being flooded, it backed off, suspended the fetch, cancelled it after a timeout, and restarted it where the player had stopped, after a lost connection, a 416 or a seek, with a cap on the bytes it queued and a document registry to cancel suspended fetches that nothing would resume. A loop on a backend without its own buffer, a second element and a reload of the same resource downloaded it again. In the resource fetch algorithm, the element now opens a reader of the media resource in the media cache of the content process instead, keyed by the requested URL, the CORS mode and the origin of the document, with a ScriptFetcher for the fetches that the cache needs. Blob and data URLs take the same path; MediaStream sources are unchanged, and preload=none still opens no reader until the media resource is needed. If the player accepts the reader as its data source, it reads from it. Otherwise the element pushes the data of the reader into the player: once the player needs data, it reads 64 KiB chunks from the byte where the player stopped and pushes them until the player has enough, when the refused chunk is read again later, or until the reader has no data there yet, when the waker of the reader continues; at most 1 MiB per task, so that cached data does not block the script thread. SeekData moves that position, and the end of the stream reaches the player as such. The resource is keyed on its URL without the fragment, so that `a.mp4#t=10` and `a.mp4` share it. The internal blob URL of a srcObject Blob is revoked once the fetcher has claimed the blob. The events of the reader map onto the media element: - The metadata of the resource sets the input size and seekability of the player, before the first data and only then, with the size first, since the OpenHarmony player reads both once. The reader reports the metadata again once it learns the length of a resource of unknown length, which the player learns as well. A CORS-cross-origin response makes the media data not origin-clean until the resource fetch algorithm runs again, as before. - Progress, which the reader reports at most every 350 ms, fires a progress event while the download is not suspended. - A suspended download sets the networkState to NETWORK_IDLE and fires suspend, and a resumed one sets it back to NETWORK_LOADING. When the download is suspended for preload=metadata, before playback was requested, the element stops delaying the load event, as the spec asks for a download suspended until the user starts playback. - Once the whole resource is cached, progress, NETWORK_IDLE and suspend follow. - An error before the media engine has the metadata runs the media data processing failure steps, which try the next source, and later, or for a resource that changed between two responses, the fatal steps with MEDIA_ERR_NETWORK, as other browsers do. So does the failure of the first fetch of the element's fetcher. The element tells the reader what it needs: playback at the bitrate of the resource, its length divided by its duration once both are known, while it plays; only the metadata for preload=metadata until playback is requested, unless it autoplays; and otherwise, as while its document is not fully active, what a paused reader keeps. Its reader is closed, also for a player that still holds it, so that the player's reads fail and the fetch stops, by the load algorithm, before the next source, by the failure and fatal steps, when the player goes away, and when its document is unloaded for good or its pipeline exits; documents keep weak references to the media elements that opened a reader for that and for their activity, and an adopted element moves to its new document. While it downloads with a reader, the element has pending activity, which the fetch listener provided before. The cache now owns what the element did for fetches, which goes: BufferedDataSource apart from the position of the push adapter, HTMLMediaElementFetchContext, the fetch listener of the media data, backing off, suspension and its timeout with the pref media_fetch_suspension_timeout_ms, the restarts, the handling of 416, the queue cap and the document registry of suspended fetches. The blob URL that the element kept for the fetches it restarted itself, for a Blob assigned to srcObject, goes too, since nothing reads it any more. Media fetches are no longer in the fetch group of the document. A navigation away from a document with a media download in progress still cancels it, since that makes the document unsalvageable, so that its unloading closes the readers; window.stop() and document.open() no longer cancel media downloads. Fork note: meant for upstream. Drop once upstream has it. Testing: the new mozilla/media-blob-url-revoked-seek.html seeks far into a blob after its URL was revoked (passes 5 of 5; phase 1 fails 5 of 5). fetch/range/non-matching-range-response.html now passes "Range response out of range of request should succeed", and html/browsers/browsing-the-web/read-media/cross-origin-video.html, whose server answers in parts, now plays (3 of 3 runs, 3 of 3 failures with phase 1); their expectations go; the other media, canvas and range tests cover the rest. See Validation for the scenarios that no WPT test covers. Validation: Linux host release builds with GStreamer, against the phase 1 build of ohos-main. `./mach test-wpt --release --timeout-multiplier 2` of html/semantics/embedded-content/media-elements, the-video-element, html/canvas/element/manual/drawing-images-to-the-canvas and imagebitmap (with drawimage_video_crossorigin_seek.sub.html), fetch/range and mozilla/media-autoplay-seek-after-ended.html, 493 tests: apart from the fixed range test, every unexpected result also occurs with the phase 1 build in isolated runs: load-removes-queued-error-event hangs while GStreamer never reports the metadata of the 539-byte sound_0.mp3 (also outside WPT: 8 of 12 runs here, 6 of 12 there), src_object_blob times out (2 of 16 and 3 of 16), seek-to-max-value fails (0 of 3 and 1 of 3), media_fragment_seek fails (3 of 3 either way), and autoplay-default-permissions-policy passes where a timeout is expected; track-cues-seeking, track-mode-disabled and video_loop_base passed 3 of 3 isolated runs on both. Scenarios with a 14 MB, 30 s H.264 file from a local server, requests and MB sent, with and without range support: play 2 / 14.3 and 1 / 14.3 (phase 1: 3 / 26.6 and 3 / 41.6), loop 2 / 14.3 and 1 / 14.3 (3 / 26.1 and 8 / 83.3), seek back 2 / 14.3 and 1 / 14.3 (3 / 25.9 and 3 / 40.1), two elements 2 / 14.3 and 1 / 14.3 (16 / 76.4 and 6 / 85.6), reload 2 / 14.3 and 1 / 14.3 (9 / 77.5 and 9 / 115.7), play again after the end 2 / 14.3 and 1 / 14.3 (3 / 26.0 and 3 / 40.9); the second request with range support reads the last 40 KB, and a loop, a seek back, a second element and a reload need no request. A 150 MB, 40 s file with preload=metadata at full speed: 1 request and 149.7 MB with and without range support (2 / 217.3 and 2 / 272.8); at 25 MB/s, two elements 2 and 1 requests for 149.7 MB (10 requests, 299.7 and 823.8 MB) and a pause of 40 s 1 request (2 / 155.4 with range support). Peak RSS is lower in every scenario, for example 397 instead of 418 MiB for the reload. At 5 MB/s, load() with another source 6 s in and a navigation away close the connection at 6.0 s, as with phase 1; a paused element removed from its document loads up to the read-ahead of a paused reader in the cache, here the whole file, where phase 1 closed the connection after 17 to 24 s. `./mach check` and `./mach check --ohos` pass; `./mach test-unit size_of` passes with HTMLVideoElement down from 1296 to 1200 bytes; `./mach test-tidy` reports only the known rustls advisories. 2026-10-29 sync: upstream's unload cleanup now closes the reader of a kept-alive element; on a DAYU200 the media set of patch 65's validation, with a page that navigates away from a playing video and back, ran without a crash with SpiderMonkey and with QuickJS. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- conflict resolution: the fetch listener this patch removes had upstream's new listener signatures (51d1117, servo#49032) and `LocalName` initiator type (servo#48953), which the fetcher of patch 99 now uses; imports merged next to upstream's `AtomicRefCell` (servo#49087) and `TracedScriptResult` (servo#48855); the patch's -96 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082). `./mach check` passes at this commit) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): the keep-alive while the resource downloads moved into upstream's `should_keep_alive`, as patch 65 now extends it; `update_reader_activity` into the split `autoplay` arm; upstream's unload cleanup closes the media reader where it cancelled the fetch, as the rest of this patch does; the removed fetch listener drops upstream's `CorsStatus` edit to it (servo#48748); `HTMLVideoElement` stays at 1168 bytes, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Oct 30, 2026
The state of the reader of the media cache, with that of the push adapter and the stall timer, made every media element larger, also the many that never load a resource. Keep it in a Box, which takes HTMLVideoElement from 1224 to 1136 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: `./mach test-unit size_of`. Validation: `./mach test-unit size_of` passes. AI-assisted: Yes (agent session; implemented by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1096, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
Upstream servo#48979 keeps a media element alive through its owner document while it plays or is eligible for autoplay, and servo#49367 lets it go after it has ended. An element that delays the load event or seeks is still collected at the next garbage collection once script drops it, which stops it and lets the load event fire early, and the keep-alive is only updated at a few points of the media element's algorithms. Like Gecko, and Blink apart from autoplay, also keep a media element alive while it delays the load event and, with a resource and no error, while it seeks. Don't keep an element without a resource alive, and keep one that is eligible for autoplay only until it has enough data: then it either plays or never will. Update the keep-alive whenever the network state, paused, seeking, the can autoplay flag, the error, the ready state or the delaying-the-load-event flag changes. Fork note: meant for upstream; found with the QuickJS backend, which frees such elements as soon as script drops them, but SpiderMonkey loses them too once a GC runs. Until the 2026-10-29 sync this patch had its own keep-alive set; it now extends upstream's. Besides the upstream change, this drops the QuickJS conditions in the expectations of autoplay-disabled-by-permissions-policy; patch 49 dropped the others. Drop once upstream has it. Testing: Adds a WPT test that unreferenced media elements keep playing across a garbage collection. Validation: Release builds of upstream f040186 with SpiderMonkey, with and without the series, `./mach test-wpt --processes 4` of html/semantics/embedded-content/media-elements, the-video-element, the-audio-element, infrastructure/assumptions/allowed-to-play.html, webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface and 2 _mozilla media tests: the new test passes 7 of 7 (harness timeout without), autoplay-disabled-by-permissions-policy and played-loop as in the updated expectations (autoplay-disabled timed out intermittently before, upstream issues servo#46012 and servo#46804); the remaining differences are track timeouts and track-cues-sorted-before-dispatch failures that both builds show intermittently, and one seek-to-max-value failure in 7 runs with the series (`currentTime` 0 right after setting it), not reproduced in 6 reruns, apart from load-removes-queued-error-event, which now hangs whenever GStreamer 1.24.2's playbin3 stalls on a `<video>` with an audio-only MP3: 4 of 6 runs on this host without the series too; the stalled element delays the load event, and before, only a garbage collection that freed it let the load event fire (upstream's intermittent tracker has 9 unexpected results for that test in total). The three tests that fail on QuickJS CI pass with forced GCs every 20 ms too. With logging of the keep-alive updates, every element in direct checks stopped being kept alive once it had been loaded and never played, played to the end, paused, replayed after the end without a seekable range, or played backwards to the start. An independent agent review found no blockers; its two should-fix findings for this patch (ended but unpaused elements were kept alive; changes of the error went through no hook) are fixed. QuickJS release build of this stack: the new tests and the media tests that had QuickJS expectations (autoplay.html, allowed-to-play.html, resource-selection-candidate-moved.html and the three autoplay permissions policy tests) give SpiderMonkey's results in 2 of 2 runs; without the series they time out as the dropped expectations said. 2026-10-29 sync, reworked onto upstream's keep-alive: release builds of this sync's stack and of plain upstream ed6a924, `./mach test-wpt --release` of the media-elements, the-video-element and the-audio-element directories with fetch, xhr, eventsource, cors, subresource-integrity, resource-timing, canvas image drawing and _mozilla/memory (2,247 tests), then 3 reruns on both of every test whose results differed: the same results on both except for intermittent ones, gc-unreferenced-media-element and upstream's playing_media_no_gc pass; a playing element's back/forward cache restore fails on both (upstream servo#48979 pauses it at unload). DAYU200 (OpenHarmony 7.0), headless release builds with SpiderMonkey and with QuickJS, `./mach test-wpt --ohos --processes 1 --timeout-multiplier 2` of the media series' tests, loading-the-media-resource, error-codes and playing-the-media-resource (75 tests): all as expected but the two autoplay permissions policy tests that pass where a timeout is expected, on both engines; no crash. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `HTMLMediaElement` import next to upstream's `TracedScriptResult` (servo#48855), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new sizes (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- upstream servo#48979 and servo#49367 landed a keep-alive set of their own: the patch now extends upstream's `should_keep_alive` with its rules (load event delay, seeking, resource and HAVE_ENOUGH_DATA conditions) and keeps its setter hooks; its own set, flag and duplicate hooks are gone, as is its +8 bytes of `HTMLVideoElement`; subject and message rewritten) AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream's WPT sync (servo#49485) now expects what this patch made autoplay-disabled-by-permissions-policy.https.sub.html do (FAIL instead of TIMEOUT), so of this patch's hunk only the removal of the QuickJS conditions remains) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
…ested The resource fetch algorithm suspended the fetch for preload=none only when the can-autoplay flag was false, which is the case once play() or pause() ran before resource selection, and nothing ever resumed it. So preload=none was ignored while the element was not asked to play, and an element that was asked to play, e.g. with `src`, `load()` and `play()`, never loaded or played. Like Gecko and Blink, suspend the fetch for preload=none only while the element is paused, has no autoplay attribute and is not loading through an explicit `load()`, and never for a blob URL, which is a local resource. Suspend before creating a media player. Resume, with steps 5.remote.1.5 to 5.remote.1.7 and after the task that stops delaying the load event, when `play()` is called, the autoplay attribute is set, or the preload attribute changes to another state. As in other browsers, a `<video preload=none>` that is not playing no longer fetches its metadata, so it has no natural size until it plays. Fork note: meant for upstream, with the three patches before (it uses patch 69's network-state setter). Drop once upstream has it. Testing: Adds a WPT test that play() plays a media element with preload=none, also with source elements; three of its six subtests time out without this change. Validation: Release builds of upstream f040186 with the series, against the same build without this patch, a direct check of preload=none cases: `play()` right after setting `src`, after `load()`, and after `pause()` now load and play (before, `readyState` stayed 0 and the `play()` promise never settled); without a request to play, the element now stays at NETWORK_IDLE and HAVE_NOTHING instead of downloading the resource; `play()`, setting `preload` to auto and setting the autoplay attribute resume the load; `load()` alone, the autoplay attribute, blob URLs and `load()` with a first source element that is unsupported or fails still load right away; `load()` followed by a `src` change suspends (like Blink); setting `currentTime` while suspended doesn't resume. The new test: 3 of 6 subtests time out without this patch, 6 of 6 pass with it (3 runs), and chrome-headless-shell 154 passes 6 of 6. `./mach test-wpt --processes 4` of the same 461 media tests as for the previous patches: only the new test changes, apart from tests that are intermittent with both builds. Unreferenced preload=none elements with `play()` now play to the end and are collected afterwards (before, they never played and were kept alive). Two rounds of independent agent review; all should-fix findings are fixed (explicit `load()` now covers every source candidate of the resource selection, blob URLs are never suspended, a resume before the stop-delaying task waits for it, so `suspend` sees NETWORK_IDLE); not done: gating the autoplay override on the sandboxed automatic features flag, whose only effect is an extra fetch. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): without patch 65's keep-alive flag, and the `autoplay` attribute arm split out of upstream's `autoplay | loop` arm to resume the suspended load; `HTMLVideoElement` is 1208 bytes, measured at this commit with a compile-time probe) AI-assisted: Yes (agent session; 2026-11-09 sync -- MANIFEST.json: the test's entry next to upstream's new media-blob-url-revoked test (servo#49206)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
…eeking When the player has enough data, the media element cancels a seekable fetch, and restarts it once the player asks for data again. It did not know which byte the player expected next, so it restarted by seeking the element to the current playback position. That queued seeking and seeked events that the page never asked for, and made GStreamer flush its pipeline and download again the data that it had already buffered. When the media resource has no seekable range, for example while its duration is unknown, the seek did nothing and playback stalled. Track the offset of the next byte that the player has not accepted: the start of the fetch plus the bytes that the player took, without a chunk that it refused because it has enough data. Restart the fetch at that offset, without a seek, and let the new fetch push its data right away, since the player already asked for it. GStreamer's source only asks for a new fetch when the pipeline seeks to an offset other than its own, and its offset moves by the same bytes, so the restarted fetch simply continues its stream. (A seek that the source declined reset its offset to 0; a later patch fixes that.) Cancel on the EnoughData event only once the next chunk arrives, rather than at once, and ignore empty chunks, like the last frame of an HTTP/2 body, so that a fetch that already delivered all of its bytes is never restarted at the end of the resource, where the server would answer with an error. The fetch context now keeps that position and whether the player has enough data, which grows HTMLVideoElement from 1248 to 1256 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: headless release builds for Linux (GStreamer 1.24) of ohos-main 02ebe64 with and without this patch, playing a 40 s, 149.7 MB H.264 MP4 (30 Mbit/s, moov first) to its end in a muted `<video preload=metadata>`, which keeps GStreamer's download buffering off so that its 50 MiB source queue fills up. From a local server with range support: without this patch, 3 requests and 223.0 MB sent, restarted after seeking and seeked events at 13 s and 27 s; with it, 3 requests restarting at the byte offsets 72.6 MB and 125.6 MB, 165.5 MB sent (the excess is the bytes in flight when a fetch was cancelled), and no seeking event. On the first version of this patch, before review fixes that do not touch this path, a trace of GStreamer's source showed its offset reaching exactly each restart offset and never going back, appsrc seeking only once, to 0, at startup, and an `<audio>` element playing the same video-only file, whose duration is reported as infinite, play all 40 s in 3 requests, where it stalls at 19.3 s after one request without this patch. Without range support: 3 requests from byte 0 either way (373.0 MB without, 375.0 MB with this patch), but no seeking event with it. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with this patch and with an ohos-main build: no new failure. Its unexpected results either also occur without this patch (media_fragment_seek fails in 3 of 3 isolated runs either way, autoplay-default-permissions-policy, the mp4 subtest of video_timeupdate_on_seek passing in 1 of 5 isolated runs without it) or did not repeat in 3 isolated runs (gc-unreferenced-media-element). `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the empty-chunk check under upstream's new `process_response_chunk` signature with a `&GlobalScope` (51d1117, servo#49032), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1216, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
…ayer is full When the player refused a chunk because it had enough data, the media element cancelled the fetch, even when the server does not support range requests. Every restart of such a fetch downloads the resource from its start again and discards the bytes before the restart offset. The refused chunk itself was dropped as well. Keep a refused chunk at the front of the queue, so that the player gets it once it asks for data again. If the fetch is not seekable, do not cancel it: lock the queue instead, keep queueing the chunks that follow, and push them once the player sends NeedData. A seekable fetch is still cancelled, and restarts at its first refused byte. Until net can suspend and resume a fetch, cap the queue at 32 MiB. Once more is queued, cancel the fetch like a seekable one, and restart it at the first byte that the player has not accepted once the player needs data again. Without range support, that restart downloads the resource from its start again and discards the bytes before that offset, as every restart did before. A restart cannot tell a live stream from a finite resource of unknown length, and keeping the bytes of a finite one would feed its start to the demuxer again, so a live stream without range support discards as many new bytes as the player had taken: after a pause long enough to reach the cap, it stalls for about as long as it had played. Below the cap, a resource is downloaded once. The OpenHarmony backend never refuses pushed data, so this does not change it. Counting the queued bytes grows HTMLVideoElement from 1256 to 1264 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: the setup of the previous patch. Without range support, the 149.7 MB file needs 2 requests and 266.7 MB, instead of 3 requests from byte 0 and 375.0 MB with the previous patch alone (373.0 MB on ohos-main): the first fetch is cancelled once 32 MiB are queued behind GStreamer's full queue, and the restart downloads the rest. Peak RSS of servoshell 429 MiB, against 407 MiB with the previous patch alone; without the cap, the whole file was downloaded once, at a peak of 464 MiB. Pausing that video for 25 s after 3 s: 2 requests, 265.1 MB and a peak of 430 MiB, against 1 request and 462 MiB without the cap, and 3 requests, 380.4 MB, two seeking events and 406 MiB on ohos-main. With range support, unchanged: 3 requests restarting at byte offsets, 169.0 MB, no seeking event. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with the series up to the last patch and with an ohos-main build: no new failure; the unexpected results (media_fragment_seek, autoplay-default-permissions-policy, load-removes-queued-error-event) also occur on ohos-main. On the first version of this patch, without the cap, track-cues-sorted-before-dispatch failed in 2 of 20 isolated runs and track-remove-by-setting-innerHTML timed out in 1 of 10, as on ohos-main. Re-run with the whole series after the second review: the range case takes 3 requests and 163.2 MB with no seeking event, and the paused case 2 requests, 266.5 MB and a peak of 426 MiB; `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of media-elements, the-video-element and drawing-images-to-the-canvas (449 tests): no new failure; track-cues-seeking timed out in 1 of 13 isolated runs both with the series and on ohos-main, and video_loop_base passed 3 of 3 isolated runs either way. After the restart without discarding was reverted, the paused case takes 2 requests, 260.2 MB and a peak of 430 MiB. `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1224, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
…r is full When its player has enough data, a media element cancels a fetch with range support, to restart it with a Range request once the player needs data again, and keeps queueing the data of a fetch without range support, up to 32 MiB, before it cancels it and fetches the resource from its start again. Every restart costs a request, on HTTP/1.1 a new connection, and the bytes that were in flight. Ask net to suspend a fetch that is read from the network instead, and queue the data that was in flight. Net answers whether it suspended the fetch. If it did, flow control holds back the server, the download is suspended (NETWORK_IDLE and suspend, then NETWORK_LOADING once it resumes, and no progress events meanwhile), and once the player needs data, the same fetch resumes and the queue drains. If it did not, as for a cache hit or when two fetches to the origin are suspended already, the fetch backs off as before; so it does if the answer is lost, and it is resumed in case net suspended it. Responses that are not read from the network are handled as before, and the cap on the queue stays for data that keeps arriving. When a fetch completes, progress, then NETWORK_IDLE and suspend follow, also if the fetch was suspended. A fetch with range support that stays suspended for media_fetch_suspension_timeout_ms (30 s) is cancelled, to restart where the player stopped once it needs data again, so that an element paused for long does not hold a connection, which servers would time out anyway. A fetch without range support stays suspended, since its restart would fetch the resource from its start again, until net gives up on it after network_fetch_suspend_timeout_ms (60 s). Such a server, and net, end the fetch: net with a network error, which ran the fatal steps (MEDIA_ERR_NETWORK, "If the connection is interrupted after some media data has been received"), and a closed connection like a complete body, so the stream ended early. So if a fetch that was suspended ends with a network error, or with fewer bytes than its Content-Length, restart it at the byte where the player stopped, with a Range request, which a server without range support answers from the start of the resource, whose bytes before that position are discarded as after a seek: at once if the player accepts data, or else once it needs data again. A restart past the end of the resource, which the server answers with 416 or which the length of the resource tells, ends the stream, as when the server's Content-Length was too large; so does a restart without range support whose body ends without an error where the player stopped. Any other restart that ends early before it delivers data runs the fatal steps: net ends a body that loses its connection without an error. A restart that delivered data may be restarted again, so a fetch is only restarted while it makes progress. The Content-Length of an encoded body is not the length of the decoded body, so it is not compared. The state of the suspension in the fetch context grows HTMLVideoElement from 1264 to 1296 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; a fetch only backs off once the 50 MiB queue of the GStreamer player is full. See Validation. Validation: Linux, GStreamer, a 150 MB, 40 s H.264 file in a muted <video preload=metadata> that plays, from a Python server that sends at most 25 MB/s per connection; the base is the parent commit. With range support: 1 request and 149.7 MB sent (base: 3 requests, 149.9 MB); networkState turns NETWORK_IDLE with a suspend event once net confirms the suspension 3.5 s in, and NETWORK_LOADING when the fetch resumes 17.4 s in, with no seeking, stalled or error event. Without range support: 1 request, 149.7 MB, peak RSS 422 MiB (base: 2 requests, 269.9 MB, 419 MiB); paused for 25 s, 1 request, 149.7 MB (base: 2 requests, 269.9 MB). Paused for 40 s with range support: the timeout cancels the fetch 30 s after the suspension, and the restart when playback needs data again plays to the end: 2 requests, 155.4 MB (base: 3 requests, 149.9 MB). Three elements on one origin: net suspends two fetches, which take 1 request each, and the third backs off when net declines its suspension: 4 requests, 449.1 MB (base: 9 requests, 449.8 MB). A suspension costs peak RSS (423 instead of 392 MiB for one element, 738 instead of 683 MiB for three), although only 53 bytes were queued when net confirmed it: once the fetch resumes, net reads at once what the socket buffers held. A server that closes a connection it could not write to for 5 s: the earlier revision of this patch without the restart ended playback after 16.5 s of the media, with no error; with it, the media plays to the end, in 3 requests and 149.7 MB with range support and 2 requests and 238.3 MB without. With network_fetch_suspend_timeout_ms=5000 and playback paused for 40 s, net ends the suspended fetch with a network error, and the media plays to the end after the restart: 3 requests and 156.9 MB with range support, 2 requests and 239.1 MB without, no error event. A server whose Content-Length is 10 MB too large: playback ends normally, as on the base; at 25 MB/s the restart fetches the 10.5 MB that were queued again (2 requests, 160.2 MB) and, without range support, the whole resource again (2 requests, 299.3 MB); at 8 and 12 MB/s the restart starts at the end of the file, which the server answers with 416 (2 requests, 149.7 MB). A server that closes idle connections and closes the restart right after its headers: MEDIA_ERR_NETWORK at the restart, 16.5 s into the media, with and without range support. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` html/semantics/embedded-content/media-elements, the-video-element and html/canvas/element/manual/drawing-images-to-the-canvas with the series: 451 tests, 446 as expected; the other five behave the same on the parent commit of the series when run alone: autoplay-default-permissions-policy.https.sub.html passes where a timeout is expected (3/3 on both), media_fragment_seek.html fails a subtest (3/3 on both), src_object_blob.html times out 1 of 3 runs on both, video_timeupdate_on_seek.html passes a subtest that is expected to time out, and load-removes-queued-error-event.html hangs intermittently because GStreamer never reports the metadata of the 539-byte sound_0.mp3 (3 of 8 runs with the series, 4 of 8 without, alternating). In a later run of media-elements, track-cues-seeking.html timed out, which it does intermittently with and without the series (3 of 39 and 2 of 39 isolated runs, alternating); its 192 KB video never fills the player. `./mach check --ohos` passes at each commit; `./mach test-tidy` reports only the known rustls advisories. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `media_fetch_suspension_timeout_ms` pref where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915), and the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-22 sync -- compile fix folded in: the two early returns for a fetch that ended early pass the fetch listener's global to `submit_timing`, which takes it since upstream 51d1117 (servo#49032)) AI-assisted: Yes (agent session; 2026-10-29 sync -- mechanical conflict resolution: the pref next to upstream's `mathml_core_enabled` (servo#48631), the origin-clean line in upstream's `CorsStatus` form (servo#48748); `HTMLVideoElement` is 1256 bytes, measured at this commit with a compile-time probe, since patch 65 no longer adds a field) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
A media element fetched its media resource itself and pushed each chunk into the player as it arrived. To keep the player from being flooded, it backed off, suspended the fetch, cancelled it after a timeout, and restarted it where the player had stopped, after a lost connection, a 416 or a seek, with a cap on the bytes it queued and a document registry to cancel suspended fetches that nothing would resume. A loop on a backend without its own buffer, a second element and a reload of the same resource downloaded it again. In the resource fetch algorithm, the element now opens a reader of the media resource in the media cache of the content process instead, keyed by the requested URL, the CORS mode and the origin of the document, with a ScriptFetcher for the fetches that the cache needs. Blob and data URLs take the same path; MediaStream sources are unchanged, and preload=none still opens no reader until the media resource is needed. If the player accepts the reader as its data source, it reads from it. Otherwise the element pushes the data of the reader into the player: once the player needs data, it reads 64 KiB chunks from the byte where the player stopped and pushes them until the player has enough, when the refused chunk is read again later, or until the reader has no data there yet, when the waker of the reader continues; at most 1 MiB per task, so that cached data does not block the script thread. SeekData moves that position, and the end of the stream reaches the player as such. The resource is keyed on its URL without the fragment, so that `a.mp4#t=10` and `a.mp4` share it. The internal blob URL of a srcObject Blob is revoked once the fetcher has claimed the blob. The events of the reader map onto the media element: - The metadata of the resource sets the input size and seekability of the player, before the first data and only then, with the size first, since the OpenHarmony player reads both once. The reader reports the metadata again once it learns the length of a resource of unknown length, which the player learns as well. A CORS-cross-origin response makes the media data not origin-clean until the resource fetch algorithm runs again, as before. - Progress, which the reader reports at most every 350 ms, fires a progress event while the download is not suspended. - A suspended download sets the networkState to NETWORK_IDLE and fires suspend, and a resumed one sets it back to NETWORK_LOADING. When the download is suspended for preload=metadata, before playback was requested, the element stops delaying the load event, as the spec asks for a download suspended until the user starts playback. - Once the whole resource is cached, progress, NETWORK_IDLE and suspend follow. - An error before the media engine has the metadata runs the media data processing failure steps, which try the next source, and later, or for a resource that changed between two responses, the fatal steps with MEDIA_ERR_NETWORK, as other browsers do. So does the failure of the first fetch of the element's fetcher. The element tells the reader what it needs: playback at the bitrate of the resource, its length divided by its duration once both are known, while it plays; only the metadata for preload=metadata until playback is requested, unless it autoplays; and otherwise, as while its document is not fully active, what a paused reader keeps. Its reader is closed, also for a player that still holds it, so that the player's reads fail and the fetch stops, by the load algorithm, before the next source, by the failure and fatal steps, when the player goes away, and when its document is unloaded for good or its pipeline exits; documents keep weak references to the media elements that opened a reader for that and for their activity, and an adopted element moves to its new document. While it downloads with a reader, the element has pending activity, which the fetch listener provided before. The cache now owns what the element did for fetches, which goes: BufferedDataSource apart from the position of the push adapter, HTMLMediaElementFetchContext, the fetch listener of the media data, backing off, suspension and its timeout with the pref media_fetch_suspension_timeout_ms, the restarts, the handling of 416, the queue cap and the document registry of suspended fetches. The blob URL that the element kept for the fetches it restarted itself, for a Blob assigned to srcObject, goes too, since nothing reads it any more. Media fetches are no longer in the fetch group of the document. A navigation away from a document with a media download in progress still cancels it, since that makes the document unsalvageable, so that its unloading closes the readers; window.stop() and document.open() no longer cancel media downloads. Fork note: meant for upstream. Drop once upstream has it. Testing: the new mozilla/media-blob-url-revoked-seek.html seeks far into a blob after its URL was revoked (passes 5 of 5; phase 1 fails 5 of 5). fetch/range/non-matching-range-response.html now passes "Range response out of range of request should succeed", and html/browsers/browsing-the-web/read-media/cross-origin-video.html, whose server answers in parts, now plays (3 of 3 runs, 3 of 3 failures with phase 1); their expectations go; the other media, canvas and range tests cover the rest. See Validation for the scenarios that no WPT test covers. Validation: Linux host release builds with GStreamer, against the phase 1 build of ohos-main. `./mach test-wpt --release --timeout-multiplier 2` of html/semantics/embedded-content/media-elements, the-video-element, html/canvas/element/manual/drawing-images-to-the-canvas and imagebitmap (with drawimage_video_crossorigin_seek.sub.html), fetch/range and mozilla/media-autoplay-seek-after-ended.html, 493 tests: apart from the fixed range test, every unexpected result also occurs with the phase 1 build in isolated runs: load-removes-queued-error-event hangs while GStreamer never reports the metadata of the 539-byte sound_0.mp3 (also outside WPT: 8 of 12 runs here, 6 of 12 there), src_object_blob times out (2 of 16 and 3 of 16), seek-to-max-value fails (0 of 3 and 1 of 3), media_fragment_seek fails (3 of 3 either way), and autoplay-default-permissions-policy passes where a timeout is expected; track-cues-seeking, track-mode-disabled and video_loop_base passed 3 of 3 isolated runs on both. Scenarios with a 14 MB, 30 s H.264 file from a local server, requests and MB sent, with and without range support: play 2 / 14.3 and 1 / 14.3 (phase 1: 3 / 26.6 and 3 / 41.6), loop 2 / 14.3 and 1 / 14.3 (3 / 26.1 and 8 / 83.3), seek back 2 / 14.3 and 1 / 14.3 (3 / 25.9 and 3 / 40.1), two elements 2 / 14.3 and 1 / 14.3 (16 / 76.4 and 6 / 85.6), reload 2 / 14.3 and 1 / 14.3 (9 / 77.5 and 9 / 115.7), play again after the end 2 / 14.3 and 1 / 14.3 (3 / 26.0 and 3 / 40.9); the second request with range support reads the last 40 KB, and a loop, a seek back, a second element and a reload need no request. A 150 MB, 40 s file with preload=metadata at full speed: 1 request and 149.7 MB with and without range support (2 / 217.3 and 2 / 272.8); at 25 MB/s, two elements 2 and 1 requests for 149.7 MB (10 requests, 299.7 and 823.8 MB) and a pause of 40 s 1 request (2 / 155.4 with range support). Peak RSS is lower in every scenario, for example 397 instead of 418 MiB for the reload. At 5 MB/s, load() with another source 6 s in and a navigation away close the connection at 6.0 s, as with phase 1; a paused element removed from its document loads up to the read-ahead of a paused reader in the cache, here the whole file, where phase 1 closed the connection after 17 to 24 s. `./mach check` and `./mach check --ohos` pass; `./mach test-unit size_of` passes with HTMLVideoElement down from 1296 to 1200 bytes; `./mach test-tidy` reports only the known rustls advisories. 2026-10-29 sync: upstream's unload cleanup now closes the reader of a kept-alive element; on a DAYU200 the media set of patch 65's validation, with a page that navigates away from a playing video and back, ran without a crash with SpiderMonkey and with QuickJS. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- conflict resolution: the fetch listener this patch removes had upstream's new listener signatures (51d1117, servo#49032) and `LocalName` initiator type (servo#48953), which the fetcher of patch 99 now uses; imports merged next to upstream's `AtomicRefCell` (servo#49087) and `TracedScriptResult` (servo#48855); the patch's -96 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082). `./mach check` passes at this commit) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): the keep-alive while the resource downloads moved into upstream's `should_keep_alive`, as patch 65 now extends it; `update_reader_activity` into the split `autoplay` arm; upstream's unload cleanup closes the media reader where it cancelled the fetch, as the rest of this patch does; the removed fetch listener drops upstream's `CorsStatus` edit to it (servo#48748); `HTMLVideoElement` stays at 1168 bytes, measured at this commit with a compile-time probe) AI-assisted: Yes (agent session; 2026-11-09 sync -- fetch_request() stays deleted although upstream gave it a blob URL claim (servo#49206): the media cache's fetcher of patch 89 takes the same claim; its imports go with it) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
The state of the reader of the media cache, with that of the push adapter and the stall timer, made every media element larger, also the many that never load a resource. Keep it in a Box, which takes HTMLVideoElement from 1224 to 1136 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: `./mach test-unit size_of`. Validation: `./mach test-unit size_of` passes. AI-assisted: Yes (agent session; implemented by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1096, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
Upstream servo#48979 keeps a media element alive through its owner document while it plays or is eligible for autoplay, and servo#49367 lets it go after it has ended. An element that delays the load event or seeks is still collected at the next garbage collection once script drops it, which stops it and lets the load event fire early, and the keep-alive is only updated at a few points of the media element's algorithms. Like Gecko, and Blink apart from autoplay, also keep a media element alive while it delays the load event and, with a resource and no error, while it seeks. Don't keep an element without a resource alive, and keep one that is eligible for autoplay only until it has enough data: then it either plays or never will. Update the keep-alive whenever the network state, paused, seeking, the can autoplay flag, the error, the ready state or the delaying-the-load-event flag changes. Fork note: meant for upstream; found with the QuickJS backend, which frees such elements as soon as script drops them, but SpiderMonkey loses them too once a GC runs. Until the 2026-10-29 sync this patch had its own keep-alive set; it now extends upstream's. Besides the upstream change, this drops the QuickJS conditions in the expectations of autoplay-disabled-by-permissions-policy; patch 49 dropped the others. Drop once upstream has it. Testing: Adds a WPT test that unreferenced media elements keep playing across a garbage collection. Validation: Release builds of upstream f040186 with SpiderMonkey, with and without the series, `./mach test-wpt --processes 4` of html/semantics/embedded-content/media-elements, the-video-element, the-audio-element, infrastructure/assumptions/allowed-to-play.html, webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface and 2 _mozilla media tests: the new test passes 7 of 7 (harness timeout without), autoplay-disabled-by-permissions-policy and played-loop as in the updated expectations (autoplay-disabled timed out intermittently before, upstream issues servo#46012 and servo#46804); the remaining differences are track timeouts and track-cues-sorted-before-dispatch failures that both builds show intermittently, and one seek-to-max-value failure in 7 runs with the series (`currentTime` 0 right after setting it), not reproduced in 6 reruns, apart from load-removes-queued-error-event, which now hangs whenever GStreamer 1.24.2's playbin3 stalls on a `<video>` with an audio-only MP3: 4 of 6 runs on this host without the series too; the stalled element delays the load event, and before, only a garbage collection that freed it let the load event fire (upstream's intermittent tracker has 9 unexpected results for that test in total). The three tests that fail on QuickJS CI pass with forced GCs every 20 ms too. With logging of the keep-alive updates, every element in direct checks stopped being kept alive once it had been loaded and never played, played to the end, paused, replayed after the end without a seekable range, or played backwards to the start. An independent agent review found no blockers; its two should-fix findings for this patch (ended but unpaused elements were kept alive; changes of the error went through no hook) are fixed. QuickJS release build of this stack: the new tests and the media tests that had QuickJS expectations (autoplay.html, allowed-to-play.html, resource-selection-candidate-moved.html and the three autoplay permissions policy tests) give SpiderMonkey's results in 2 of 2 runs; without the series they time out as the dropped expectations said. 2026-10-29 sync, reworked onto upstream's keep-alive: release builds of this sync's stack and of plain upstream ed6a924, `./mach test-wpt --release` of the media-elements, the-video-element and the-audio-element directories with fetch, xhr, eventsource, cors, subresource-integrity, resource-timing, canvas image drawing and _mozilla/memory (2,247 tests), then 3 reruns on both of every test whose results differed: the same results on both except for intermittent ones, gc-unreferenced-media-element and upstream's playing_media_no_gc pass; a playing element's back/forward cache restore fails on both (upstream servo#48979 pauses it at unload). DAYU200 (OpenHarmony 7.0), headless release builds with SpiderMonkey and with QuickJS, `./mach test-wpt --ohos --processes 1 --timeout-multiplier 2` of the media series' tests, loading-the-media-resource, error-codes and playing-the-media-resource (75 tests): all as expected but the two autoplay permissions policy tests that pass where a timeout is expected, on both engines; no crash. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `HTMLMediaElement` import next to upstream's `TracedScriptResult` (servo#48855), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new sizes (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- upstream servo#48979 and servo#49367 landed a keep-alive set of their own: the patch now extends upstream's `should_keep_alive` with its rules (load event delay, seeking, resource and HAVE_ENOUGH_DATA conditions) and keeps its setter hooks; its own set, flag and duplicate hooks are gone, as is its +8 bytes of `HTMLVideoElement`; subject and message rewritten) AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream's WPT sync (servo#49485) now expects what this patch made autoplay-disabled-by-permissions-policy.https.sub.html do (FAIL instead of TIMEOUT), so of this patch's hunk only the removal of the QuickJS conditions remains) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
…ested The resource fetch algorithm suspended the fetch for preload=none only when the can-autoplay flag was false, which is the case once play() or pause() ran before resource selection, and nothing ever resumed it. So preload=none was ignored while the element was not asked to play, and an element that was asked to play, e.g. with `src`, `load()` and `play()`, never loaded or played. Like Gecko and Blink, suspend the fetch for preload=none only while the element is paused, has no autoplay attribute and is not loading through an explicit `load()`, and never for a blob URL, which is a local resource. Suspend before creating a media player. Resume, with steps 5.remote.1.5 to 5.remote.1.7 and after the task that stops delaying the load event, when `play()` is called, the autoplay attribute is set, or the preload attribute changes to another state. As in other browsers, a `<video preload=none>` that is not playing no longer fetches its metadata, so it has no natural size until it plays. Fork note: meant for upstream, with the three patches before (it uses patch 69's network-state setter). Drop once upstream has it. Testing: Adds a WPT test that play() plays a media element with preload=none, also with source elements; three of its six subtests time out without this change. Validation: Release builds of upstream f040186 with the series, against the same build without this patch, a direct check of preload=none cases: `play()` right after setting `src`, after `load()`, and after `pause()` now load and play (before, `readyState` stayed 0 and the `play()` promise never settled); without a request to play, the element now stays at NETWORK_IDLE and HAVE_NOTHING instead of downloading the resource; `play()`, setting `preload` to auto and setting the autoplay attribute resume the load; `load()` alone, the autoplay attribute, blob URLs and `load()` with a first source element that is unsupported or fails still load right away; `load()` followed by a `src` change suspends (like Blink); setting `currentTime` while suspended doesn't resume. The new test: 3 of 6 subtests time out without this patch, 6 of 6 pass with it (3 runs), and chrome-headless-shell 154 passes 6 of 6. `./mach test-wpt --processes 4` of the same 461 media tests as for the previous patches: only the new test changes, apart from tests that are intermittent with both builds. Unreferenced preload=none elements with `play()` now play to the end and are collected afterwards (before, they never played and were kept alive). Two rounds of independent agent review; all should-fix findings are fixed (explicit `load()` now covers every source candidate of the resource selection, blob URLs are never suspended, a resume before the stop-delaying task waits for it, so `suspend` sees NETWORK_IDLE); not done: gating the autoplay override on the sandboxed automatic features flag, whose only effect is an extra fetch. AI-assisted: Yes (agent session; root-caused, written and tested by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): without patch 65's keep-alive flag, and the `autoplay` attribute arm split out of upstream's `autoplay | loop` arm to resume the suspended load; `HTMLVideoElement` is 1208 bytes, measured at this commit with a compile-time probe) AI-assisted: Yes (agent session; 2026-11-09 sync -- MANIFEST.json: the test's entry next to upstream's new media-blob-url-revoked test (servo#49206)) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
…eeking When the player has enough data, the media element cancels a seekable fetch, and restarts it once the player asks for data again. It did not know which byte the player expected next, so it restarted by seeking the element to the current playback position. That queued seeking and seeked events that the page never asked for, and made GStreamer flush its pipeline and download again the data that it had already buffered. When the media resource has no seekable range, for example while its duration is unknown, the seek did nothing and playback stalled. Track the offset of the next byte that the player has not accepted: the start of the fetch plus the bytes that the player took, without a chunk that it refused because it has enough data. Restart the fetch at that offset, without a seek, and let the new fetch push its data right away, since the player already asked for it. GStreamer's source only asks for a new fetch when the pipeline seeks to an offset other than its own, and its offset moves by the same bytes, so the restarted fetch simply continues its stream. (A seek that the source declined reset its offset to 0; a later patch fixes that.) Cancel on the EnoughData event only once the next chunk arrives, rather than at once, and ignore empty chunks, like the last frame of an HTTP/2 body, so that a fetch that already delivered all of its bytes is never restarted at the end of the resource, where the server would answer with an error. The fetch context now keeps that position and whether the player has enough data, which grows HTMLVideoElement from 1248 to 1256 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: headless release builds for Linux (GStreamer 1.24) of ohos-main 02ebe64 with and without this patch, playing a 40 s, 149.7 MB H.264 MP4 (30 Mbit/s, moov first) to its end in a muted `<video preload=metadata>`, which keeps GStreamer's download buffering off so that its 50 MiB source queue fills up. From a local server with range support: without this patch, 3 requests and 223.0 MB sent, restarted after seeking and seeked events at 13 s and 27 s; with it, 3 requests restarting at the byte offsets 72.6 MB and 125.6 MB, 165.5 MB sent (the excess is the bytes in flight when a fetch was cancelled), and no seeking event. On the first version of this patch, before review fixes that do not touch this path, a trace of GStreamer's source showed its offset reaching exactly each restart offset and never going back, appsrc seeking only once, to 0, at startup, and an `<audio>` element playing the same video-only file, whose duration is reported as infinite, play all 40 s in 3 requests, where it stalls at 19.3 s after one request without this patch. Without range support: 3 requests from byte 0 either way (373.0 MB without, 375.0 MB with this patch), but no seeking event with it. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with this patch and with an ohos-main build: no new failure. Its unexpected results either also occur without this patch (media_fragment_seek fails in 3 of 3 isolated runs either way, autoplay-default-permissions-policy, the mp4 subtest of video_timeupdate_on_seek passing in 1 of 5 isolated runs without it) or did not repeat in 3 isolated runs (gc-unreferenced-media-element). `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the empty-chunk check under upstream's new `process_response_chunk` signature with a `&GlobalScope` (51d1117, servo#49032), and the patch's +8 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1216, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
…ayer is full When the player refused a chunk because it had enough data, the media element cancelled the fetch, even when the server does not support range requests. Every restart of such a fetch downloads the resource from its start again and discards the bytes before the restart offset. The refused chunk itself was dropped as well. Keep a refused chunk at the front of the queue, so that the player gets it once it asks for data again. If the fetch is not seekable, do not cancel it: lock the queue instead, keep queueing the chunks that follow, and push them once the player sends NeedData. A seekable fetch is still cancelled, and restarts at its first refused byte. Until net can suspend and resume a fetch, cap the queue at 32 MiB. Once more is queued, cancel the fetch like a seekable one, and restart it at the first byte that the player has not accepted once the player needs data again. Without range support, that restart downloads the resource from its start again and discards the bytes before that offset, as every restart did before. A restart cannot tell a live stream from a finite resource of unknown length, and keeping the bytes of a finite one would feed its start to the demuxer again, so a live stream without range support discards as many new bytes as the player had taken: after a pause long enough to reach the cap, it stalls for about as long as it had played. Below the cap, a resource is downloaded once. The OpenHarmony backend never refuses pushed data, so this does not change it. Counting the queued bytes grows HTMLVideoElement from 1256 to 1264 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; the player only refuses data once its 50 MiB queue is full, which needs a much larger resource than a WPT test can use. See Validation. Validation: the setup of the previous patch. Without range support, the 149.7 MB file needs 2 requests and 266.7 MB, instead of 3 requests from byte 0 and 375.0 MB with the previous patch alone (373.0 MB on ohos-main): the first fetch is cancelled once 32 MiB are queued behind GStreamer's full queue, and the restart downloads the rest. Peak RSS of servoshell 429 MiB, against 407 MiB with the previous patch alone; without the cap, the whole file was downloaded once, at a peak of 464 MiB. Pausing that video for 25 s after 3 s: 2 requests, 265.1 MB and a peak of 430 MiB, against 1 request and 462 MiB without the cap, and 3 requests, 380.4 MB, two seeking events and 406 MiB on ohos-main. With range support, unchanged: 3 requests restarting at byte offsets, 169.0 MB, no seeking event. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of html/semantics/embedded-content/media-elements and the-video-element (432 tests) with the series up to the last patch and with an ohos-main build: no new failure; the unexpected results (media_fragment_seek, autoplay-default-permissions-policy, load-removes-queued-error-event) also occur on ohos-main. On the first version of this patch, without the cap, track-cues-sorted-before-dispatch failed in 2 of 20 isolated runs and track-remove-by-setting-innerHTML timed out in 1 of 10, as on ohos-main. Re-run with the whole series after the second review: the range case takes 3 requests and 163.2 MB with no seeking event, and the paused case 2 requests, 266.5 MB and a peak of 426 MiB; `./mach test-wpt --release --processes 6 --timeout-multiplier 2` of media-elements, the-video-element and drawing-images-to-the-canvas (449 tests): no new failure; track-cues-seeking timed out in 1 of 13 isolated runs both with the series and on ohos-main, and video_loop_base passed 3 of 3 isolated runs either way. After the restart without discarding was reverted, the paused case takes 2 requests, 260.2 MB and a peak of 430 MiB. `./mach check --ohos` passes. AI-assisted: Yes (agent session; written and tested by the agent, reviewed by another agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1224, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
…r is full When its player has enough data, a media element cancels a fetch with range support, to restart it with a Range request once the player needs data again, and keeps queueing the data of a fetch without range support, up to 32 MiB, before it cancels it and fetches the resource from its start again. Every restart costs a request, on HTTP/1.1 a new connection, and the bytes that were in flight. Ask net to suspend a fetch that is read from the network instead, and queue the data that was in flight. Net answers whether it suspended the fetch. If it did, flow control holds back the server, the download is suspended (NETWORK_IDLE and suspend, then NETWORK_LOADING once it resumes, and no progress events meanwhile), and once the player needs data, the same fetch resumes and the queue drains. If it did not, as for a cache hit or when two fetches to the origin are suspended already, the fetch backs off as before; so it does if the answer is lost, and it is resumed in case net suspended it. Responses that are not read from the network are handled as before, and the cap on the queue stays for data that keeps arriving. When a fetch completes, progress, then NETWORK_IDLE and suspend follow, also if the fetch was suspended. A fetch with range support that stays suspended for media_fetch_suspension_timeout_ms (30 s) is cancelled, to restart where the player stopped once it needs data again, so that an element paused for long does not hold a connection, which servers would time out anyway. A fetch without range support stays suspended, since its restart would fetch the resource from its start again, until net gives up on it after network_fetch_suspend_timeout_ms (60 s). Such a server, and net, end the fetch: net with a network error, which ran the fatal steps (MEDIA_ERR_NETWORK, "If the connection is interrupted after some media data has been received"), and a closed connection like a complete body, so the stream ended early. So if a fetch that was suspended ends with a network error, or with fewer bytes than its Content-Length, restart it at the byte where the player stopped, with a Range request, which a server without range support answers from the start of the resource, whose bytes before that position are discarded as after a seek: at once if the player accepts data, or else once it needs data again. A restart past the end of the resource, which the server answers with 416 or which the length of the resource tells, ends the stream, as when the server's Content-Length was too large; so does a restart without range support whose body ends without an error where the player stopped. Any other restart that ends early before it delivers data runs the fatal steps: net ends a body that loses its connection without an error. A restart that delivered data may be restarted again, so a fetch is only restarted while it makes progress. The Content-Length of an encoded body is not the length of the decoded body, so it is not compared. The state of the suspension in the fetch context grows HTMLVideoElement from 1264 to 1296 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: no test; a fetch only backs off once the 50 MiB queue of the GStreamer player is full. See Validation. Validation: Linux, GStreamer, a 150 MB, 40 s H.264 file in a muted <video preload=metadata> that plays, from a Python server that sends at most 25 MB/s per connection; the base is the parent commit. With range support: 1 request and 149.7 MB sent (base: 3 requests, 149.9 MB); networkState turns NETWORK_IDLE with a suspend event once net confirms the suspension 3.5 s in, and NETWORK_LOADING when the fetch resumes 17.4 s in, with no seeking, stalled or error event. Without range support: 1 request, 149.7 MB, peak RSS 422 MiB (base: 2 requests, 269.9 MB, 419 MiB); paused for 25 s, 1 request, 149.7 MB (base: 2 requests, 269.9 MB). Paused for 40 s with range support: the timeout cancels the fetch 30 s after the suspension, and the restart when playback needs data again plays to the end: 2 requests, 155.4 MB (base: 3 requests, 149.9 MB). Three elements on one origin: net suspends two fetches, which take 1 request each, and the third backs off when net declines its suspension: 4 requests, 449.1 MB (base: 9 requests, 449.8 MB). A suspension costs peak RSS (423 instead of 392 MiB for one element, 738 instead of 683 MiB for three), although only 53 bytes were queued when net confirmed it: once the fetch resumes, net reads at once what the socket buffers held. A server that closes a connection it could not write to for 5 s: the earlier revision of this patch without the restart ended playback after 16.5 s of the media, with no error; with it, the media plays to the end, in 3 requests and 149.7 MB with range support and 2 requests and 238.3 MB without. With network_fetch_suspend_timeout_ms=5000 and playback paused for 40 s, net ends the suspended fetch with a network error, and the media plays to the end after the restart: 3 requests and 156.9 MB with range support, 2 requests and 239.1 MB without, no error event. A server whose Content-Length is 10 MB too large: playback ends normally, as on the base; at 25 MB/s the restart fetches the 10.5 MB that were queued again (2 requests, 160.2 MB) and, without range support, the whole resource again (2 requests, 299.3 MB); at 8 and 12 MB/s the restart starts at the end of the file, which the server answers with 416 (2 requests, 149.7 MB). A server that closes idle connections and closes the restart right after its headers: MEDIA_ERR_NETWORK at the restart, 16.5 s into the media, with and without range support. `./mach test-wpt --release --processes 6 --timeout-multiplier 2` html/semantics/embedded-content/media-elements, the-video-element and html/canvas/element/manual/drawing-images-to-the-canvas with the series: 451 tests, 446 as expected; the other five behave the same on the parent commit of the series when run alone: autoplay-default-permissions-policy.https.sub.html passes where a timeout is expected (3/3 on both), media_fragment_seek.html fails a subtest (3/3 on both), src_object_blob.html times out 1 of 3 runs on both, video_timeupdate_on_seek.html passes a subtest that is expected to time out, and load-removes-queued-error-event.html hangs intermittently because GStreamer never reports the metadata of the 539-byte sound_0.mp3 (3 of 8 runs with the series, 4 of 8 without, alternating). In a later run of media-elements, track-cues-seeking.html timed out, which it does intermittently with and without the series (3 of 39 and 2 of 39 isolated runs, alternating); its 192 KB video never fills the player. `./mach check --ohos` passes at each commit; `./mach test-tidy` reports only the known rustls advisories. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the `media_fetch_suspension_timeout_ms` pref where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915), and the patch's +32 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-22 sync -- compile fix folded in: the two early returns for a fetch that ended early pass the fetch listener's global to `submit_timing`, which takes it since upstream 51d1117 (servo#49032)) AI-assisted: Yes (agent session; 2026-10-29 sync -- mechanical conflict resolution: the pref next to upstream's `mathml_core_enabled` (servo#48631), the origin-clean line in upstream's `CorsStatus` form (servo#48748); `HTMLVideoElement` is 1256 bytes, measured at this commit with a compile-time probe, since patch 65 no longer adds a field) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
A media element fetched its media resource itself and pushed each chunk into the player as it arrived. To keep the player from being flooded, it backed off, suspended the fetch, cancelled it after a timeout, and restarted it where the player had stopped, after a lost connection, a 416 or a seek, with a cap on the bytes it queued and a document registry to cancel suspended fetches that nothing would resume. A loop on a backend without its own buffer, a second element and a reload of the same resource downloaded it again. In the resource fetch algorithm, the element now opens a reader of the media resource in the media cache of the content process instead, keyed by the requested URL, the CORS mode and the origin of the document, with a ScriptFetcher for the fetches that the cache needs. Blob and data URLs take the same path; MediaStream sources are unchanged, and preload=none still opens no reader until the media resource is needed. If the player accepts the reader as its data source, it reads from it. Otherwise the element pushes the data of the reader into the player: once the player needs data, it reads 64 KiB chunks from the byte where the player stopped and pushes them until the player has enough, when the refused chunk is read again later, or until the reader has no data there yet, when the waker of the reader continues; at most 1 MiB per task, so that cached data does not block the script thread. SeekData moves that position, and the end of the stream reaches the player as such. The resource is keyed on its URL without the fragment, so that `a.mp4#t=10` and `a.mp4` share it. The internal blob URL of a srcObject Blob is revoked once the fetcher has claimed the blob. The events of the reader map onto the media element: - The metadata of the resource sets the input size and seekability of the player, before the first data and only then, with the size first, since the OpenHarmony player reads both once. The reader reports the metadata again once it learns the length of a resource of unknown length, which the player learns as well. A CORS-cross-origin response makes the media data not origin-clean until the resource fetch algorithm runs again, as before. - Progress, which the reader reports at most every 350 ms, fires a progress event while the download is not suspended. - A suspended download sets the networkState to NETWORK_IDLE and fires suspend, and a resumed one sets it back to NETWORK_LOADING. When the download is suspended for preload=metadata, before playback was requested, the element stops delaying the load event, as the spec asks for a download suspended until the user starts playback. - Once the whole resource is cached, progress, NETWORK_IDLE and suspend follow. - An error before the media engine has the metadata runs the media data processing failure steps, which try the next source, and later, or for a resource that changed between two responses, the fatal steps with MEDIA_ERR_NETWORK, as other browsers do. So does the failure of the first fetch of the element's fetcher. The element tells the reader what it needs: playback at the bitrate of the resource, its length divided by its duration once both are known, while it plays; only the metadata for preload=metadata until playback is requested, unless it autoplays; and otherwise, as while its document is not fully active, what a paused reader keeps. Its reader is closed, also for a player that still holds it, so that the player's reads fail and the fetch stops, by the load algorithm, before the next source, by the failure and fatal steps, when the player goes away, and when its document is unloaded for good or its pipeline exits; documents keep weak references to the media elements that opened a reader for that and for their activity, and an adopted element moves to its new document. While it downloads with a reader, the element has pending activity, which the fetch listener provided before. The cache now owns what the element did for fetches, which goes: BufferedDataSource apart from the position of the push adapter, HTMLMediaElementFetchContext, the fetch listener of the media data, backing off, suspension and its timeout with the pref media_fetch_suspension_timeout_ms, the restarts, the handling of 416, the queue cap and the document registry of suspended fetches. The blob URL that the element kept for the fetches it restarted itself, for a Blob assigned to srcObject, goes too, since nothing reads it any more. Media fetches are no longer in the fetch group of the document. A navigation away from a document with a media download in progress still cancels it, since that makes the document unsalvageable, so that its unloading closes the readers; window.stop() and document.open() no longer cancel media downloads. Fork note: meant for upstream. Drop once upstream has it. Testing: the new mozilla/media-blob-url-revoked-seek.html seeks far into a blob after its URL was revoked (passes 5 of 5; phase 1 fails 5 of 5). fetch/range/non-matching-range-response.html now passes "Range response out of range of request should succeed", and html/browsers/browsing-the-web/read-media/cross-origin-video.html, whose server answers in parts, now plays (3 of 3 runs, 3 of 3 failures with phase 1); their expectations go; the other media, canvas and range tests cover the rest. See Validation for the scenarios that no WPT test covers. Validation: Linux host release builds with GStreamer, against the phase 1 build of ohos-main. `./mach test-wpt --release --timeout-multiplier 2` of html/semantics/embedded-content/media-elements, the-video-element, html/canvas/element/manual/drawing-images-to-the-canvas and imagebitmap (with drawimage_video_crossorigin_seek.sub.html), fetch/range and mozilla/media-autoplay-seek-after-ended.html, 493 tests: apart from the fixed range test, every unexpected result also occurs with the phase 1 build in isolated runs: load-removes-queued-error-event hangs while GStreamer never reports the metadata of the 539-byte sound_0.mp3 (also outside WPT: 8 of 12 runs here, 6 of 12 there), src_object_blob times out (2 of 16 and 3 of 16), seek-to-max-value fails (0 of 3 and 1 of 3), media_fragment_seek fails (3 of 3 either way), and autoplay-default-permissions-policy passes where a timeout is expected; track-cues-seeking, track-mode-disabled and video_loop_base passed 3 of 3 isolated runs on both. Scenarios with a 14 MB, 30 s H.264 file from a local server, requests and MB sent, with and without range support: play 2 / 14.3 and 1 / 14.3 (phase 1: 3 / 26.6 and 3 / 41.6), loop 2 / 14.3 and 1 / 14.3 (3 / 26.1 and 8 / 83.3), seek back 2 / 14.3 and 1 / 14.3 (3 / 25.9 and 3 / 40.1), two elements 2 / 14.3 and 1 / 14.3 (16 / 76.4 and 6 / 85.6), reload 2 / 14.3 and 1 / 14.3 (9 / 77.5 and 9 / 115.7), play again after the end 2 / 14.3 and 1 / 14.3 (3 / 26.0 and 3 / 40.9); the second request with range support reads the last 40 KB, and a loop, a seek back, a second element and a reload need no request. A 150 MB, 40 s file with preload=metadata at full speed: 1 request and 149.7 MB with and without range support (2 / 217.3 and 2 / 272.8); at 25 MB/s, two elements 2 and 1 requests for 149.7 MB (10 requests, 299.7 and 823.8 MB) and a pause of 40 s 1 request (2 / 155.4 with range support). Peak RSS is lower in every scenario, for example 397 instead of 418 MiB for the reload. At 5 MB/s, load() with another source 6 s in and a navigation away close the connection at 6.0 s, as with phase 1; a paused element removed from its document loads up to the read-ahead of a paused reader in the cache, here the whole file, where phase 1 closed the connection after 17 to 24 s. `./mach check` and `./mach check --ohos` pass; `./mach test-unit size_of` passes with HTMLVideoElement down from 1296 to 1200 bytes; `./mach test-tidy` reports only the known rustls advisories. 2026-10-29 sync: upstream's unload cleanup now closes the reader of a kept-alive element; on a DAYU200 the media set of patch 65's validation, with a page that navigates away from a playing video and back, ran without a crash with SpiderMonkey and with QuickJS. AI-assisted: Yes (agent session; implemented, tested and measured by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- conflict resolution: the fetch listener this patch removes had upstream's new listener signatures (51d1117, servo#49032) and `LocalName` initiator type (servo#48953), which the fetcher of patch 99 now uses; imports merged next to upstream's `AtomicRefCell` (servo#49087) and `TracedScriptResult` (servo#48855); the patch's -96 bytes of `HTMLVideoElement` applied to upstream's new size (servo#48082). `./mach check` passes at this commit) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict resolution next to upstream's keep-alive (servo#48979): the keep-alive while the resource downloads moved into upstream's `should_keep_alive`, as patch 65 now extends it; `update_reader_activity` into the split `autoplay` arm; upstream's unload cleanup closes the media reader where it cancelled the fetch, as the rest of this patch does; the removed fetch listener drops upstream's `CorsStatus` edit to it (servo#48748); `HTMLVideoElement` stays at 1168 bytes, measured at this commit with a compile-time probe) AI-assisted: Yes (agent session; 2026-11-09 sync -- fetch_request() stays deleted although upstream gave it a blob URL claim (servo#49206): the media cache's fetcher of patch 89 takes the same claim; its imports go with it) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
The state of the reader of the media cache, with that of the push adapter and the stall timer, made every media element larger, also the many that never load a resource. Keep it in a Box, which takes HTMLVideoElement from 1224 to 1136 bytes. Fork note: meant for upstream. Drop once upstream has it. Testing: `./mach test-unit size_of`. Validation: `./mach test-unit size_of` passes. AI-assisted: Yes (agent session; implemented by the agent) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the patch's size change of `HTMLVideoElement` applied to upstream's new size (servo#48082)) AI-assisted: Yes (agent session; 2026-10-29 sync -- conflict in the `HTMLVideoElement` size expectation only, since patch 65 no longer adds a field; the size, 1096, measured at this commit with a compile-time probe) Signed-off-by: Jonathan Schwender <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing: There is one new passing WPT test, expectations are updated.