tor-browser

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

commit 625cc68b41ae3d258ecab6ff725e21ad3d7067cb
parent fed22d4272b812e966fb1b922ebb7cdeb1577298
Author: Daniel Vogelheim <30862698+otherdaniel@users.noreply.github.com>
Date:   Wed, 15 Oct 2025 09:14:06 +0000

Bug 1994242 [wpt PR 55420] - Be explicit about TypeError's realm., a=testonly

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

This fixes up the patch in #55060, to be more like #55164.

The TypeError thrown in this tests needs to belong to the same realm as
the element is it called from, namely `divAdoptedFromIframe`.
element, which doesn't work on Chrome. #55164 fixes this by executing
"return TypeError" via the element's constructor's Function object,
accessed via `.constructor.constructor`. This technique works across
browsers, is based on fully spec'ed behaviour, and is used in a number
of places across WPT. Here, we adopt the same technique.
--

wpt-commits: 08c1ff3cb33dd06fdb2713b38430e5ef1b9b9af4
wpt-pr: 55420

Diffstat:
Mtesting/web-platform/tests/trusted-types/require-trusted-types-for-TypeError-belongs-to-the-global-object-realm.html | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testing/web-platform/tests/trusted-types/require-trusted-types-for-TypeError-belongs-to-the-global-object-realm.html b/testing/web-platform/tests/trusted-types/require-trusted-types-for-TypeError-belongs-to-the-global-object-realm.html @@ -13,7 +13,8 @@ promise_test(async t => { const iframe = document.createElement("iframe"); const passThroughPolicy = - trustedTypes.createPolicy("passThrough", { createHTML: s => s }); + trustedTypes.createPolicy("passThrough", { createHTML: s => s, + createScript: s => s }); iframe.srcdoc = passThroughPolicy.createHTML("<!DOCTYPE html><div></div>"); await new Promise(resolve => { iframe.addEventListener("load", resolve); @@ -29,7 +30,8 @@ // realm. // Discussion at: https://github.com/web-platform-tests/wpt/issues/45405 assert_throws_js( - divAdoptedFromIframe.ownerDocument.defaultView.TypeError, + divAdoptedFromIframe.constructor.constructor( + passThroughPolicy.createScript("return TypeError"))(), _ => divAdoptedFromIframe.innerHTML = 'unsafe'); }, "Setting innerHTML on a node adopted from a subframe."); </script>