[WPT] Various test cases in custom-elements/registries/element-mutation.html fail#69430
Merged
webkit-commit-queue merged 1 commit intoJul 15, 2026
Conversation
Collaborator
|
EWS run on current version of this PR (hash 054822f) Details
|
Member
Author
|
Not sure what's going on with GTK+'s |
…on.html fail https://bugs.webkit.org/show_bug.cgi?id=319388 Reviewed by Chris Dumez. The failure was caused by a built-in element (e.g. div) parsed inside an declarative shadow root with null registry (e.g. declared with shadowrootcustomelementregistry content attribute on template) not getting the usesNullCustomElementRegistry flag - only custom elements and unknown elements did (in HTMLConstructionSite's createHTMLElementOrFindCustomElementInterface inside the "if (!element)" block). The built-in element merely resolved to null via its tree scope. That worked for the original (parsed before any global registry was ensured), but broke on cloning: once the global registry exists, cloning the subtree runs Element::insertionSteps on the cloned nodes which pins the cloned element with the global registry in the scoped map. Once pinned, registry.initialize(shadowRoot) could no longer hand it the scoped registry - hence the failures. This PR applies two fixes to address the failures. 1. HTMLConstructionSite.cpp - set usesNullCustomElementRegistry on all elements (built-in included) parsed inside a null-registry tree scope, so an element behaves identically to its clones and keeps resolving to null across mutations. This unifies the previously separate custom-element and fragment-parsing branches. 2. Element::attachShadow - an imperative attachShadow() with no explicit registry now always defaults to the document's registry, instead of null when the host carries the null-registry flag. The host stays null; only the new shadow root uses the global registry. (2) is required because (1) gives built-in elements the flag, and without it their attachShadow default would flip to null. As a bonus, it also fixes the pre-existing ShadowRoot-init-declarative.html custom-element FAIL, which failed for this exact reason. Finally, this PR also addresses a bug that we weren't propagating the parent node's null-registry-ness to a child node during non-fragment parsing by generalizing the condition (no longer checks m_isParsingFragment). Test: imported/w3c/web-platform-tests/custom-elements/registries/element-mutation.html * LayoutTests/imported/w3c/web-platform-tests/custom-elements/registries/ShadowRoot-init-declarative-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/custom-elements/registries/element-mutation-expected.txt: * Source/WebCore/dom/Element.cpp: * Source/WebCore/html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Canonical link: https://commits.webkit.org/317215@main
054822f to
8b4bcb5
Compare
Collaborator
|
Committed 317215@main (8b4bcb5): https://commits.webkit.org/317215@main Reviewed commits have been landed. Closing PR #69430 and removing active labels. |
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.
8b4bcb5
054822f