tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f077de62b9a00c09f843342e0ede34161d32d9e4
parent 86af92025037330feb68f64ec6dfba85aabd1e04
Author: Jayson Chen <jaysonchen1127@gmail.com>
Date:   Wed,  3 Dec 2025 14:43:46 +0000

Bug 2002489 [wpt PR 56283] - Update upgrade criteria test, a=testonly

Automatic update from web-platform-tests
Update upgrade criteria test (#56283)

* Use scoped registry instead of global

* Align test content with the test title as iframe document should provide a global registry

* Address comments

---------

Co-authored-by: Jayson Chen <jaysonchen@microsoft.com>
--

wpt-commits: 96e4648e3f1a82fdf03d4bf044b2c31776359ed3
wpt-pr: 56283

Diffstat:
Mtesting/web-platform/tests/custom-elements/registries/scoped-registry-append-does-not-upgrade.html | 15+++++++++++++--
Mtesting/web-platform/tests/custom-elements/registries/scoped-registry-define-upgrade-criteria.html | 4++--
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/testing/web-platform/tests/custom-elements/registries/scoped-registry-append-does-not-upgrade.html b/testing/web-platform/tests/custom-elements/registries/scoped-registry-append-does-not-upgrade.html @@ -92,11 +92,22 @@ test((test) => { const [doc2, win2] = makeIframe(test); win2.customElements.define('a-b', class ABElement extends win2.HTMLElement { }); const elementFromDoc1 = doc1.createElement('a-b'); - assert_equals(elementFromDoc1.customElementRegistry, null); + assert_equals(elementFromDoc1.customElementRegistry, win1.customElements); doc2.body.appendChild(elementFromDoc1); assert_equals(elementFromDoc1.customElementRegistry, win2.customElements); assert_true(elementFromDoc1 instanceof ABElement); -}, 'Inserting a node from another document results in the custom element registry to be set and upgraded.'); +}, 'Inserting a node from another document with global registry results in the custom element registry to be set and upgraded.'); + +test((test) => { + const contentDocument = document.implementation.createHTMLDocument(); + class ABElement extends HTMLElement { } + customElements.define('a-b', ABElement); + const elementFromContentDoc = contentDocument.createElement('a-b'); + assert_equals(elementFromContentDoc.customElementRegistry, null); + document.body.appendChild(elementFromContentDoc); + assert_equals(elementFromContentDoc.customElementRegistry, customElements); + assert_true(elementFromContentDoc instanceof ABElement); +}, 'Inserting a node from another document with null registry results in the custom element registry to be set and upgraded.'); </script> </body> diff --git a/testing/web-platform/tests/custom-elements/registries/scoped-registry-define-upgrade-criteria.html b/testing/web-platform/tests/custom-elements/registries/scoped-registry-define-upgrade-criteria.html @@ -129,10 +129,10 @@ test(t => { shadow.appendChild(node); class TestElement extends HTMLElement {}; - customElements.define(name, TestElement); + registry.define(name, TestElement); assert_true(node instanceof TestElement); -}, 'Adding definition to global registry should upgrade nodes even after the node is moved into a separate shadow tree.'); +}, 'Adding definition to scoped registry should upgrade nodes even after the node is moved into a separate shadow tree.'); test(t => { const name = nextCustomElementName();