Closed Bug 2081349 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63602 - Reland "Fix script scheduling, style blocking, and abort cleanup for HTMLStream"

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Attachments

(1 file)

Sync web-platform-tests PR 63602 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/63602
Details from upstream follow.

Noam Rosenthal <nrosenthal@chromium.org> wrote:

Reland "Fix script scheduling, style blocking, and abort cleanup for HTMLStream"

This is a reland of commit f19d15d649bb5bb0f4b2359e5537eb37ce5957cf

Fix flaky failure in stream-html-defer-async-script.html on Debug bots
by wiring window.on_slow and awaiting window.slow_async.promise in
the async scripts do not block parsing and run in load order subtest
so that slow.js does not finish during the subsequent abort subtest
and pollute window.events.

Original change's description:

Fix script scheduling, style blocking, and abort cleanup for HTMLStream

Align HTMLDocumentParser, HTMLTreeBuilder, HTMLParserScriptRunner,
ScriptLoader, and PendingScript with the WHATWG HTML spec for
streaming fragment parsers:

  • Do not block streamed inline, parser-blocking, or defer scripts on
    script-blocking stylesheets in the live target document.
  • Keep classic non-async, non-defer external scripts parser-blocking
    (kParserBlocking) for the stream, and yield to the event loop before
    executing deferred/module scripts at close().
  • Flush pending text (including kTextMode) at the end of each chunk and
    before StopParsing(), so written text is in the DOM when write()
    resolves and no text is left buffered in HTMLConstructionSite when a
    writer is dropped, aborted, or its write() rejects.
  • On StopParsing() / Detach() for fragment parsers ("abort a parser",
    fragment case), mark open \<script> elements already-started, pop all
    open elements so elements like \<style> finish parsing children, and
    cancel pending parser-blocking and deferred scripts, which also
    unblocks rendering on them.
  • At EOF in the "text" insertion mode, mark an unclosed \<script>
    already-started for fragment parsers, so it never runs even if it is
    later connected. The same step for the main document parser is a
    web-visible behavior change (an unclosed \<script src> at EOF currently
    executes) and is left for a separate, flagged CL (see TODO).

WPT coverage includes parser-blocking/defer/async script scheduling,
abort unblocking rendering, bare text inserted before close(), and an
unclosed \<script> at close() being marked already-started. The
parser-blocking script tests depend on the displaced reference node
handling in crrev.com/c/8498307, which this CL is based on.

Bug: 491743369
Fixed: 568820698
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8498308
Commit-Queue: Noam Rosenthal \<nrosenthal@google.com>
Reviewed-by: Mason Freed \<masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1716037}

Bug: 491743369, 572938271
Change-Id: I26da393c542f3ae88c75e1a287f6da403b9913ea
Fixed: 568820698
Reviewed-on: https://chromium-review.googlesource.com/8569537
WPT-Export-Revision: 1895743a9d02084b07f78cd8b9412d54fbba8c91

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Attached file Notable wpt changes —

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 38 tests

Status Summary

Firefox

OK : 3[GitHub] 37[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 1[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 56[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 49[GitHub] 1703[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 3
PASS: 42
FAIL: 7

Safari

OK : 3
FAIL: 49

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

(See attachment for full changes)

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: