commit 965e8e9b9c1f9ef527a883b171159cacbeaa2711
parent 67197c27d91f66a920d91f672e8d929b1d923a13
Author: Daniel Vogelheim <30862698+otherdaniel@users.noreply.github.com>
Date: Fri, 3 Oct 2025 08:59:19 +0000
Bug 1990845 [wpt PR 55060] - Be explicit about TypeError's realm in require-trusted-types-for-TypeError-belongs-to-the-global-object-realm., a=testonly
Automatic update from web-platform-tests
Be explicit about TypeError's realm. (#55060)
--
wpt-commits: 493ae8a4fefa344a9f51f13ec50bfc013a628149
wpt-pr: 55060
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
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
@@ -21,6 +21,15 @@
});
const divAdoptedFromIframe =
document.adoptNode(iframe.contentDocument.body.firstElementChild);
- assert_throws_js(TypeError, _ => divAdoptedFromIframe.innerHTML = 'unsafe');
+
+ // There are cross-browser differences about which realm a node returned
+ // by Document.adoptNode belongs to. Here, we expect that Trusted Types will
+ // throw an exception from divAdoptedFromIframe'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
+ assert_throws_js(
+ divAdoptedFromIframe.ownerDocument.defaultView.TypeError,
+ _ => divAdoptedFromIframe.innerHTML = 'unsafe');
}, "Setting innerHTML on a node adopted from a subframe.");
</script>