Closed Bug 2079675 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63370 - Do not synchronously fire speculation rules error events on base changes

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 63370 into mozilla-central (this bug is closed when the sync is complete).

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

Joey Arhar <jarhar@chromium.org> wrote:

Do not synchronously fire speculation rules error events on base changes

When a \<base> element is inserted, removed, or has its href attribute
modified, Document::ProcessBaseElement() updates the document's base URL
and notifies ScriptLoader::DocumentBaseURLChanged(). If the document
contains an invalid \<script type="speculationrules">, reparsing it in
ScriptLoader::AddSpeculationRuleSet() synchronously dispatches error
events on the script element and window, running script while
EventDispatchForbiddenScope is active during DOM insertion, removal, or
attribute cloning.

Fix this by:

  1. Checking isConnected() in HTMLBaseElement::ParseAttribute() so
    modifying or cloning attributes on a disconnected \<base> element does
    not call Document::ProcessBaseElement().
  2. Returning early in ScriptLoader::DocumentBaseURLChanged() if the
    speculation rule set failed to parse, since top-level parse errors do
    not depend on the base URL.

Bug: 568730794
Change-Id: Ib0167ae383b089c7548befb797b674212dca1479
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8508876
Commit-Queue: Joey Arhar \<jarhar@chromium.org>
Reviewed-by: David Baron \<dbaron@chromium.org>
Reviewed-by: Joey Arhar \<jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1713725}

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 537 tests and 8 subtests

Status Summary

Firefox

OK : 238[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt] 239[Gecko-windows11-32-25h2-opt] 240[Gecko-windows11-32-25h2-debug, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 242[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]
PASS : 1[GitHub] 2[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 143[Gecko-windows11-32-25h2-opt] 144[Gecko-windows11-64-25h2-opt] 146[Gecko-windows11-64-25h2-debug] 148[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-linux2404-64-opt] 150[Gecko-linux2404-64-debug] 151[Gecko-windows11-32-25h2-debug] 152[Gecko-android-em-14-x86_64-lite-opt-geckoview] 153[Gecko-android-em-14-x86_64-opt-geckoview]
FAIL : 224[Gecko-linux2404-64-debug] 225[Gecko-android-em-14-x86_64-opt-geckoview, Gecko-windows11-32-25h2-debug] 226[Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-linux2404-64-opt] 230[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-windows11-64-25h2-debug] 232[Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-opt]
TIMEOUT: 2
ERROR : 289
NOTRUN : 2

Chrome

CRASH : 2

Safari

OK : 1
PASS : 2

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: