[wpt-sync] Sync PR 63278 - Sanitizer: place children of replaceWithChildren elements correctly
Categories
(Core :: DOM: Core & HTML, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Attachments
(1 file)
|
164.10 KB,
text/plain
|
Details |
Sync web-platform-tests PR 63278 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/63278
Details from upstream follow.
Noam Rosenthal <nrosenthal@chromium.org> wrote:
Sanitizer: place children of replaceWithChildren elements correctly
When the streaming sanitizer replaces an open element with its children
(replaceWithChildrenElements), nodes parsed under it have to be inserted
where that element would have been, not merely under its parent. This
went wrong in a few cases exercised by setHTML()/setHTMLUnsafe():
- Foster parenting: an unwrapped element that was itself foster-parented
(e.g. \<table>\<div>…\</div>\<td>) lost its insertion point, so its
children ended up after the table instead of before it; and a table
whose parent is unwrapped foster-parented text into the wrong node.- \<template>: a template has no light-tree children, so replacing it
with its children must drop its contents rather than hoist them into
the parent. This matches Sanitizer::ReplaceWithChildren for already
parsed trees and the existing sanitizer-api tree-construction cases
(whose failing baseline is now removed).- A declarative shadow root inside an unwrapped element must not be
attached on behalf of that element.- OwnerDocumentForCurrentNode and the custom element registry lookup now
resolve through unwrapped elements to the real intended parent.HTMLStackItem now records the replaced insertion location (parent and
next child) when a foster-parented element is unwrapped, and
HTMLConstructionSite::AdjustInsertionLocation / FindFosterSite /
CreateElement consult it. ShouldInsertChild takes the adjusted location.New sanitizer-api WPT coverage uses setHTML()/setHTMLUnsafe(). The
streamHTML() counterparts (stream-html-sanitizer.html, plus the scoped
custom element registry case in stream-html-custom-element.html, which
setHTMLUnsafe() cannot exercise yet, see crbug.com/569832084) are
included too, since they are fixed by this same change.Bug: 569831431, 491743369
Change-Id: I75d3930029c7d68fad8b7dea4c6e4d85f831d628
Reviewed-on: https://chromium-review.googlesource.com/8512657
WPT-Export-Revision: 2f6cb80ce9ce9fc06c9ff0191573a5814da04795
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=100519
| Assignee | ||
Comment 2•1 month ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, and Chrome on GitHub CI
Total 70 tests
Status Summary
Firefox
OK : 4[GitHub] 69[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] 111[GitHub] 1991[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: 294[GitHub] 1674[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 : 4
PASS: 349
FAIL: 56
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
(See attachment for full changes)
https://hg.mozilla.org/mozilla-central/rev/a42e0d707c5f
https://hg.mozilla.org/mozilla-central/rev/cc5164dbbe78
Description
•