Closed Bug 2039659 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 59409 - Fix importNode fallback registry not propagating to nested null-registry descendants

Categories

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

task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox152 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Jayson Chen <jaysonchen@microsoft.com> wrote:

Fix importNode fallback registry not propagating to nested null-registry descendants

When importNode clones a tree with a provided customElementRegistry
fallback, the fallback should be used for all descendants with null
registries. Previously, Element::CloneWithChildren passed the
resolved registry (which could be an intermediate ancestor's own
registry) as the fallback for children, instead of propagating the
original fallback_registry through the entire clone tree.

For example, given: container(null) > e1(registry1) > e1Null(null),
calling importNode(container, {customElementRegistry: registry})
would incorrectly assign registry1 to e1Null instead of registry.

Fix: Add a separate fallback_registry parameter to CloneWithChildren
so the resolved registry is used for element creation while the
original fallback propagates unchanged to all descendants. Also pass
fallback_registry when cloning shadow root children instead of nullptr.

Bug: 491031515
Change-Id: I43d67d0d574431b284260eb1581a6f74a8fee651
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7770294
Commit-Queue: Jayson Chen \<jaysonchen@microsoft.com>
Reviewed-by: Joey Arhar \<jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1619147}

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

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

Total 37 tests and 1975 subtests

Status Summary

Firefox

OK : 37
PASS : 2149
FAIL : 200
ERROR: 1

Chrome

OK : 1
PASS : 19
FAIL : 1

Safari

OK : 1
PASS : 20

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /custom-elements/registries/Construct.html [wpt.fyi]
    • A constructor creating an element from another registry before or after super call should work: FAIL
  • /custom-elements/registries/CustomElementRegistry-initialize.html [wpt.fyi]
    • initialize throws when the registry scoped is false and the root is the document.: FAIL
    • initialize throws when the registry scoped is false and the root document already has another registry: FAIL
    • initialize is a function on both global and scoped CustomElementRegistry: FAIL
    • initialize sets element.customElementRegistry to the global registry: FAIL
    • initialize does not set the registry of nested shadow tree to the global registry: FAIL
    • initialize sets element.customElementRegistry to a scoped registry: FAIL
    • initialize does not set descendants whose customElementRegistry already uses a different registry: FAIL
    • initialize does not set the registry of nested shadow tree to a scoped registry: FAIL
    • initialize sets element.customElementRegistry permantently: FAIL
    • initialize is no-op on a subtree with a non-null registry: FAIL
    • initialize works on Document: FAIL
    • initialize works on DocumentFragment: FAIL
    • initialize sets registry on shadow root descendants with no registry: FAIL
  • /custom-elements/registries/CustomElementRegistry-upgrade.html [wpt.fyi]
    • upgrade is a no-op when called on a shadow root with no association: FAIL
    • upgrade is a no-op when called on an element associated with a different registry: FAIL
    • upgrade should upgrade a candidate element when called on a shadow root with an association: FAIL
    • upgrade should not upgrade a candidate element not associated with a registry: FAIL
  • /custom-elements/registries/Document-createElement.html [wpt.fyi]
    • createElement should use the specified scoped registry: FAIL
    • createElement should create a builtin element regardless of a custom element registry specified: FAIL
    • createElement should create an upgrade candidate when there is no matching definition in the specified registry: FAIL
    • document.createElement should create a builtin element with null registry if customElementRegistry is set to null: FAIL
    • document.createElement should create a custom element candidate with null registry if customElementRegistry is set to null: FAIL
    • document.createElement should create a custom element candidate with null registry if customElementRegistry is set to null even if there is a custom element of the same name in the glboal registry: FAIL
    • createElement should create an upgrade candidate and the candidate should be upgraded when the element is defined: FAIL
    • createElement on a non-HTML document should still handle registries correctly: FAIL
  • /custom-elements/registries/Document-createElementNS.html [wpt.fyi]
    • createElementNS should use the specified scoped registry: FAIL
    • createElementNS should create a builtin element regardless of a custom element registry specified: FAIL
    • createElementNS should create an upgrade candidate when there is no matching definition in the specified registry: FAIL
    • document.createElement should create a builtin element with null registry if customElement is set to null: FAIL
    • document.createElement should create a custom element candidate with null registry if customElement is set to null: FAIL
    • document.createElement should create a defined custom element with null registry if customElement is set to null: FAIL
    • createElementNS should create an upgrade candidate and the candidate should be upgraded when the element is defined: FAIL
    • createElementNS on a non-HTML document should still handle registries correctly: FAIL
  • /custom-elements/registries/Document-customElementRegistry.html [wpt.fyi]
    • customElementRegistry on a document of a disconnected iframe should return contentWindow.customElements: FAIL
  • /custom-elements/registries/Document-importNode-cross-document.window.html [wpt.fyi]
    • Cloning with scoped registry: FAIL
    • Cloning including shadow tree with scoped registry: FAIL
    • Cloning with scoped registry (null registry target): FAIL
    • Cloning including shadow tree with scoped registry (null registry target): FAIL
  • /custom-elements/registries/Document-importNode.html [wpt.fyi]: ERROR [GitHub], OK [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, Safari: OK)
    • importNode should clone using the specified registry if target's registry is null: FAIL (Chrome: PASS, Safari: PASS)
    • importNode should preserve null-ness of custom element registry: FAIL (Chrome: PASS, Safari: PASS)
    • importNode should clone a shadow host with a declarative shadow DOM using a specified scoped registry: FAIL (Chrome: PASS, Safari: PASS)
    • importNode should clone using target's registry if non-null, including when it's not the global registry: FAIL (Chrome: PASS, Safari: PASS)
    • importNode should clone a template content using a specified scoped registry: FAIL (Chrome: PASS, Safari: PASS)
    • importNode: pass options argument with value { selfOnly: true }: FAIL (Chrome: PASS, Safari: PASS)
    • importNode: pass options argument with value { customElementRegistry: null }: FAIL (Chrome: PASS, Safari: PASS)
    • importNode should use the provided fallback registry for null-registry descendants nested under non-null-registry ancestors: FAIL (Chrome: FAIL, Safari: PASS)
  • /custom-elements/registries/Element-customElementRegistry-exceptions.html [wpt.fyi]
    • customElementRegistry on a failed custom element created by calling createElement on CustomElementRegistry should return the registry: FAIL
    • customElementRegistry on a failed custom element created by setting innerHTML should return the associated scoped registry: FAIL
    • customElementRegistry on a failed custom element created by parser should return the specified custom regsitry: FAIL
  • /custom-elements/registries/Element-customElementRegistry.html [wpt.fyi]
    • customElementRegistry on an element inside a declarative shadow DOM with shadowrootcustomelementregistry should return null: FAIL
    • customElementRegistry on a clone of a declarative shadow tree with shadowrootcustomelementregistry should return null: FAIL
    • customElementRegistry on a clone of a declarative shadow tree with shadowrootcustomelementregistry should return the global registry after getting inserted into a document: FAIL
    • customElementRegistry on an element inside a declarative shadow DOM with shadowrootcustomelementregistry should return the scoped registry after calling initialize: FAIL
    • customElementRegistry on a builtin element created by calling createElement on CustomElementRegistry should return the registry: FAIL
    • customElementRegistry on an upgarde candidate created by calling createElement on CustomElementRegistry should return the registry: FAIL
    • customElementRegistry on an unknown element created by calling createElement on CustomElementRegistry should return the registry: FAIL
    • customElementRegistry on a defined custom element created by calling createElement on CustomElementRegistry should return the registry: FAIL
    • customElementRegistry inside a custom element constructor should return the correct registry: FAIL
  • /custom-elements/registries/Element-innerHTML.html [wpt.fyi]
    • innerHTML on a disconnected element should use the scoped registry it was created with: FAIL
    • nested descendants in innerHTML on a disconnected element should use the scoped registry the element was created with: FAIL
    • innerHTML on a disconnected element should use the scoped registry it was created with when parsing a simple HTML: FAIL
    • innerHTML on an inserted element should continue to use the scoped registry it was created with: FAIL
    • nested descendants in innerHTML should use the null registry when the container element has null registry: FAIL
    • insertAdjacentHTML should use the element's registry even when the registry is null: FAIL
    • createContextualFragment on a range inside a template should use null registry even when the template has a scoped registry: FAIL
    • createContextualFragment on a range inside an element with scoped registry should use the scoped registry of the element: FAIL
  • /custom-elements/registries/ShadowRoot-init-customElementRegistry.html [wpt.fyi]
    • A newly attached ShadowRoot should use the global registry by default even if the host uses a custom registry: FAIL
    • A newly attached ShadowRoot should use the global registry by default even if the host is within another shadow tree that uses a custom registry: FAIL
    • A newly attached disconnected ShadowRoot should use the scoped registry if explicitly specified in attachShadow: FAIL
    • A newly attached connected ShadowRoot should use the scoped registry if explicitly specified in attachShadow: FAIL
    • attachShadow() should use null registry when customElementRegistry is null (host uses global registry): FAIL
    • attachShadow() should use null registry when customElementRegistry is null (host uses custom registry): FAIL
    • attchShadow on a builtin element with null customElementRegistry should create a ShadowRoot with null registry: FAIL
    • attchShadow on a custom elememnt candidate with null customElementRegistry should create a ShadowRoot with null registry: FAIL
    • attchShadow on a custom elememnt with null customElementRegistry should create a ShadowRoot with null registry: FAIL
  • /custom-elements/registries/ShadowRoot-init-declarative.html [wpt.fyi]
    • Custom element inside 'shadowrootcustomelementregistry' declarative shadow root should use document's registry as attachShadow default registry: FAIL
    • Built-in element inside 'shadowrootcustomelementregistry' declarative shadow root should use document's registry as attachShadow default registry: FAIL
  • /custom-elements/registries/ShadowRoot-innerHTML.html [wpt.fyi]
    • innerHTML on a shadow root should use the scoped registry: FAIL
    • innerHTML on a connected shadow root should use the associated scoped registry: FAIL
    • innerHTML on a connected shadow root should not upgrade a custom element inside a template element: FAIL
    • innerHTML on a connected shadow root should be able to create an unknown element: FAIL
  • /custom-elements/registries/adoption.window.html [wpt.fyi]
    • Adoption with scoped registry: FAIL
    • Adoption with global registry into a scoped registry: FAIL
    • Adoption with explicit global registry into a scoped registry: FAIL
    • Adoption with scoped registry into a scoped registry: FAIL
    • Adoption including shadow root with scoped registry: FAIL
    • Adoption including shadow root with global registry into a scoped registry: FAIL
    • Adoption including shadow root with explicit global registry into a scoped registry: FAIL
    • Adoption including shadow root with scoped registry into a scoped registry: FAIL
    • Adoption with scoped registry (null registry target): FAIL
    • Adoption with global registry into a scoped registry (null registry target): FAIL
    • Adoption with explicit global registry into a scoped registry (null registry target): FAIL
    • Adoption with scoped registry into a scoped registry (null registry target): FAIL
    • Adoption including shadow root with scoped registry (null registry target): FAIL
    • Adoption including shadow root with global registry into a scoped registry (null registry target): FAIL
    • Adoption including shadow root with explicit global registry into a scoped registry (null registry target): FAIL
    • Adoption including shadow root with scoped registry into a scoped registry (null registry target): FAIL
    • Adoption with global registry (scoped registry target): FAIL
    • Adoption with explicit global registry (scoped registry target): FAIL
    • Adoption with scoped registry (scoped registry target): FAIL
    • Adoption with global registry into a scoped registry (scoped registry target): FAIL
    • Adoption with explicit global registry into a scoped registry (scoped registry target): FAIL
    • Adoption with scoped registry into a scoped registry (scoped registry target): FAIL
    • Adoption including shadow root with global registry (scoped registry target): FAIL
    • Adoption including shadow root with explicit global registry (scoped registry target): FAIL
    • Adoption including shadow root with scoped registry (scoped registry target): FAIL
    • Adoption including shadow root with global registry into a scoped registry (scoped registry target): FAIL
    • Adoption including shadow root with explicit global registry into a scoped registry (scoped registry target): FAIL
    • Adoption including shadow root with scoped registry into a scoped registry (scoped registry target): FAIL
  • /custom-elements/registries/constructor-reentry-with-different-definition.html [wpt.fyi]
    • Re-entry via upgrade before calling super(): FAIL
    • Re-entry via upgrade after calling super(): FAIL
    • Re-entry via direct constructor call before calling super(): FAIL
    • Re-entry via direct constructor call after calling super(): FAIL
  • /custom-elements/registries/element-mutation-null-registry-removal.html [wpt.fyi]
    • An element's null customElementRegistry should not mutate after removal from a declarative shadow root with shadowrootcustomelementregistry.: FAIL
  • /custom-elements/registries/element-mutation.html [wpt.fyi]
    • An element with scoped registry should not change its registry when run append out of the shadow tree.: FAIL
    • An element with scoped registry should not change its registry when run append into another shadow tree with different scoped registry.: FAIL
    • An element with scoped registry should not change its registry when run appendChild out of the shadow tree.: FAIL
    • An element with scoped registry should not change its registry when run appendChild into another shadow tree with different scoped registry.: FAIL
    • An element with scoped registry should not change its registry when run prepend out of the shadow tree.: FAIL
    • An element with scoped registry should not change its registry when run prepend into another shadow tree with different scoped registry.: FAIL
    • Declarative shadow DOM with shadowrootcustomelementregistry attribute without registry initialized should remain null registry after adoption.: FAIL
  • /custom-elements/registries/global.window.html [wpt.fyi]
    • initialize() of global registry should throw for nodes from another document: FAIL
    • createElement() should throw with global registry from another document: FAIL
    • createElementNS() should throw with global registry from another document: FAIL
    • attachShadow() should throw with global registry from another document: FAIL
    • importNode() should throw with global registry from another document: FAIL
  • /custom-elements/registries/initial-about-blank.window.html [wpt.fyi]
    • Each navigable document has its own registry: FAIL
  • /custom-elements/registries/pseudo-class-defined.window.html [wpt.fyi]
    • "uncustomized" :defined doesn't care about your registry': FAIL
    • "custom" :defined doesn't care about your registry: FAIL
    • "custom" :defined should apply after initialize: FAIL
  • /custom-elements/registries/scoped-custom-element-registry-customelementregistry-attribute-in-xhtml.xhtml [wpt.fyi]
    • XHTML parser should create a custom element candidate with null registry if customelementregistry is set: FAIL
    • XHTML parser should create a defined custom element with null registry if customelementregistry is set: FAIL
    • XHTML fragment parser should create a custom element candidate with null registry if customelementregistry is set: FAIL
    • XHTML fragment parser should create a defined custom element with null registry if customelementregistry is set: FAIL
  • /custom-elements/registries/scoped-custom-element-registry-customelementregistry-attribute.html [wpt.fyi]
    • HTML parser should create a builtin element with null registry if customelementregistry is set: FAIL
    • Cloning a builtin element with null regsitry should create an element with null registry: FAIL
    • HTML parser should create a custom element candidate with null registry if customelementregistry is set: FAIL
    • Cloning a custom element candidate with null regsitry should create an element with null registry: FAIL
    • HTML parser should create a custom element with null registry if customelementregistry is set: FAIL
    • Cloning a custom element with null regsitry should create an element with null registry: FAIL
    • Descendants of an element with customelementregistry should use null registry: FAIL
  • /custom-elements/registries/scoped-registry-append-does-not-upgrade.html [wpt.fyi]
    • Connecting a custom element candiate in a shadow root with a scoped custom element registry has null registry by default: FAIL
    • Connecting a custom element candiate with null registry does not set the registry: FAIL
    • Connecting a custom element candiate with a scoped custom element registry does not change the registry: FAIL
    • Inserting a custom element candiate with null registry does not change the registry: FAIL
    • Inserting the shadow host of a shadow root with a scoped custom element registry does not change the registry: FAIL
  • /custom-elements/registries/scoped-registry-define-upgrade-criteria.html [wpt.fyi]
    • Adding definition to scoped registry should upgrade nodes associated with the registry.: FAIL
    • Adding definition to global registry should not affect shadow roots using scoped registry: FAIL
    • Adding definition to scoped registry should affect all associated shadow roots: FAIL
    • Adding definition to scoped registry should not affect document tree scope: FAIL
    • Adding definition to scoped registry should not affect shadow roots using other registries: FAIL
    • Adding definition to scoped registry should upgrade nodes even after the node is moved into a separate shadow tree.: FAIL
    • Adding definition to scoped registry should upgrade nodes even after the node is moved to a separate shadow tree using a different registry.: FAIL
    • Adding definition to scoped registry affects associated shadow roots in all iframes: FAIL
    • Adding definition to scoped registry affects associated shadow roots in other frame trees: FAIL
  • /custom-elements/registries/scoped-registry-define-upgrade-order.html [wpt.fyi]
    • Upgrade in tree order in the same tree scope: FAIL
    • Upgrade in shadow-including tree order across tree scopes: FAIL
    • Upgrade order does not depend on shadow root attach order: FAIL
    • Upgrade in association order across documents, then tree order in each document: FAIL
    • Upgrade order is not affected by DOM order between child frames: FAIL
    • Upgrade order is affected by shadow tree adoption across documents: FAIL
    • Elements in the "owner" window of a scoped registry are not always upgraded first: FAIL
  • /custom-elements/registries/scoped-registry-initialize-upgrades.html [wpt.fyi]
    • Document: CustomElementRegistry.prototype.initialize should upgrade the element given to the first argument: FAIL
    • Document: CustomElementRegistry.prototype.initialize should upgrade elements in tree order: FAIL
    • Document: CustomElementRegistry.prototype.initialize only upgrades elements beloning to the registry: FAIL
    • HTMLDocument: CustomElementRegistry.prototype.initialize should upgrade the element given to the first argument: FAIL
    • HTMLDocument: CustomElementRegistry.prototype.initialize should upgrade elements in tree order: FAIL
    • HTMLDocument: CustomElementRegistry.prototype.initialize only upgrades elements beloning to the registry: FAIL
    • XHTMLDocument: CustomElementRegistry.prototype.initialize should upgrade the element given to the first argument: FAIL
    • XHTMLDocument: CustomElementRegistry.prototype.initialize should upgrade elements in tree order: FAIL
    • XHTMLDocument: CustomElementRegistry.prototype.initialize only upgrades elements beloning to the registry: FAIL
    • CustomElementRegistry.prototype.initialize upgrades already initialized elements: FAIL
    • CustomElementRegistry.prototype.initialize upgrades custom elements in declarative shadow root when initialize() runs before define(): FAIL
    • CustomElementRegistry.prototype.initialize upgrades custom elements in imperative shadow root when inserted before define(): FAIL
  • /custom-elements/registries/scoped-registry-initialize.html [wpt.fyi]
    • Document: customElementRegistry of an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • Document: customElementRegistry of an upgrade candidate created with an explicit customElementRegistry argument should return the registry: FAIL
    • Document: customElementRegistry of an unknown element after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • Document: customElementRegistry of an unknown element created with an explicit customElementRegistry argument should return the registry: FAIL
    • Document: customElementRegistry of document and an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • Document: customElementRegistry of an element created after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • HTMLDocument: customElementRegistry of an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • HTMLDocument: customElementRegistry of an upgrade candidate created with an explicit customElementRegistry argument should return the registry: FAIL
    • HTMLDocument: customElementRegistry of an unknown element after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • HTMLDocument: customElementRegistry of an unknown element created with an explicit customElementRegistry argument should return the registry: FAIL
    • HTMLDocument: customElementRegistry of document and an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • HTMLDocument: customElementRegistry of an element created after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of an upgrade candidate created with an explicit customElementRegistry argument should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of an unknown element after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of an unknown element created with an explicit customElementRegistry argument should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of document and an upgrade candidate after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
    • XHTMLDocument: customElementRegistry of an element created after calling CustomElementRegistry.prototype.initialize should return the registry: FAIL
  • /custom-elements/registries/template.window.html [wpt.fyi]
    • shadowRootCustomElementRegistry reflects as string: FAIL
    • Serializing a null registry ShadowRoot with a global registry host (document): FAIL
    • Serializing a scoped registry ShadowRoot with a global registry host (document): FAIL
    • Serializing a scoped registry ShadowRoot with a null registry host (document): FAIL
    • Serializing a null registry ShadowRoot with a scoped registry host (document): FAIL
    • Serializing a scoped registry ShadowRoot with a scoped registry host (document): FAIL
    • A declarative shadow root gets its default registry from its node document: FAIL
Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0f1188c5e334 https://hg.mozilla.org/integration/autoland/rev/4da2ff2b2fbc [wpt PR 59409] - Fix importNode fallback registry not propagating to nested null-registry descendants, a=testonly https://github.com/mozilla-firefox/firefox/commit/9d7e2aea4423 https://hg.mozilla.org/integration/autoland/rev/818f95efd9f1 [wpt PR 59409] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
You need to log in before you can comment on or make changes to this bug.