document-domain-nested-navigate.window.js (812B)
1 async_test(t => { 2 // Setting document.domain makes this document cross-origin with that of the frame. However, 3 // about:blank will end up reusing the origin of this document, at which point the frame's 4 // document is no longer cross-origin. 5 const frame = document.body.appendChild(document.createElement('iframe')); 6 document.domain = document.domain; 7 frame.src = "/common/blank.html"; 8 frame.onload = t.step_func(() => { 9 assert_throws_dom("SecurityError", () => window[0].document); 10 frame.src = "about:blank"; 11 frame.onload = t.step_func_done(() => { 12 // Ensure we can access the child browsing context after navigation to non-initial about:blank 13 assert_equals(window[0].document, frame.contentDocument); 14 }); 15 }); 16 }, "Navigated frame to about:blank and document.domain");