1
0
Fork 0
firefox/testing/web-platform/tests/html/browsers/windows/document-domain-nested-navigate.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

16 lines
812 B
JavaScript

async_test(t => {
// Setting document.domain makes this document cross-origin with that of the frame. However,
// about:blank will end up reusing the origin of this document, at which point the frame's
// document is no longer cross-origin.
const frame = document.body.appendChild(document.createElement('iframe'));
document.domain = document.domain;
frame.src = "/common/blank.html";
frame.onload = t.step_func(() => {
assert_throws_dom("SecurityError", () => window[0].document);
frame.src = "about:blank";
frame.onload = t.step_func_done(() => {
// Ensure we can access the child browsing context after navigation to non-initial about:blank
assert_equals(window[0].document, frame.contentDocument);
});
});
}, "Navigated frame to about:blank and document.domain");