url-fragment.window.js (1205B)
1 async_test(t => { 2 const frame = document.body.appendChild(document.createElement("iframe")), 3 urlSansHash = document.URL; 4 t.add_cleanup(() => { frame.remove(); }); 5 assert_equals(frame.contentDocument.URL, "about:blank"); 6 assert_equals(frame.contentWindow.location.href, "about:blank"); 7 self.onhashchange = t.step_func_done(() => { 8 frame.contentDocument.open(); 9 assert_equals(frame.contentDocument.URL, urlSansHash); 10 assert_equals(frame.contentWindow.location.href, urlSansHash); 11 }); 12 self.location.hash = "heya"; 13 }, "document.open() and document's URL containing a fragment (entry is not relevant)"); 14 15 window.testDone = undefined; 16 async_test(t => { 17 const frame = document.body.appendChild(document.createElement("iframe")) 18 t.add_cleanup(() => { frame.remove(); }); 19 frame.src = "resources/url-frame.html#heya"; 20 window.testDone = t.step_func_done((beforeURL, afterURL) => { 21 assert_equals(beforeURL, frame.src); 22 assert_equals(afterURL, frame.src); 23 assert_equals(frame.contentDocument.URL, frame.src); 24 assert_equals(frame.contentWindow.location.href, frame.src); 25 }); 26 }, "document.open() and document's URL containing a fragment (entry is relevant)");