tor-browser

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

commit f5eae79be00fc7ad216c0ff4875acbf6289f9e54
parent 237071961ffe7cce0ecf3ea00208031940311664
Author: Luke Warlow <lwarlow@igalia.com>
Date:   Thu,  9 Oct 2025 20:33:05 +0000

Bug 1992147 [wpt PR 55164] - Be explicit about TypeError's realm, a=testonly

Automatic update from web-platform-tests
Be explicit about TypeError's realm (#55164)

This addresses a cross-browser inconsistency that's unrelated to Trusted Types.
--

wpt-commits: cb34af6d0164d80781ebd1e56589138bc623c0ae
wpt-pr: 55164

Diffstat:
Mtesting/web-platform/tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-after-adoption-from-non-TT-realm.html | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/testing/web-platform/tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-after-adoption-from-non-TT-realm.html b/testing/web-platform/tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-after-adoption-from-non-TT-realm.html @@ -25,6 +25,7 @@ <script> const passThroughPolicy = trustedTypes.createPolicy("passThrough", { createHTML: (s) => s, + createScript: (s) => s, }); function runTest(aTestElement) { @@ -111,10 +112,17 @@ // invokes <https://www.w3.org/TR/trusted-types/#validate-attribute-mutation>. // The latter should throw when executing step 5. - assert_throws_js(TypeError, () => { + // There are cross-browser differences about which realm a node returned + // by Document.adoptNode belongs to. Here, we expect that Trusted Types will + // throw a exception from sourceElement's realm, but without + // taking a stance about whether this should be the window's or the iframe's + // realm. + // Discussion at: https://github.com/web-platform-tests/wpt/issues/45405 + const expectedTypeError = new sourceElement.constructor.constructor(passThroughPolicy.createScript("return TypeError"))(); + assert_throws_js(expectedTypeError, () => { sourceElement.setAttributeNode(sourceAttr); }); - assert_throws_js(TypeError, () => { + assert_throws_js(expectedTypeError, () => { sourceElement.setAttributeNS( sourceAttr.namespaceURI, sourceAttr.name,