cross-document-nav-cross-document-traversal.html (1318B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Cross-document traversal during cross-document navigation</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <!-- 8 According to the spec, "apply the history step" will set the ongoing 9 navigation to "traversal", canceling any non-mature navigations. 10 --> 11 12 <body> 13 <script type="module"> 14 import { createIframe, waitForLoad, delay } from "./resources/helpers.mjs"; 15 16 promise_test(async t => { 17 const iframe = await createIframe(t); 18 19 // Setup 20 // Extra delay()s are necessary because if we navigate "inside" the load 21 // handler (i.e. in a promise reaction for the load handler) then it will 22 // be a replace navigation. 23 iframe.contentWindow.location.search = "?1"; 24 await waitForLoad(iframe); 25 await delay(t, 0); 26 iframe.contentWindow.location.search = "?2"; 27 await waitForLoad(iframe); 28 await delay(t, 0); 29 30 iframe.contentWindow.location.search = "?3"; 31 iframe.contentWindow.history.back(); 32 33 assert_equals(iframe.contentWindow.location.search, "?2", "must not go back synchronously"); 34 35 await waitForLoad(iframe); 36 assert_equals(iframe.contentWindow.location.search, "?1", "must go back one step eventually"); 37 }, "cross-document navigations are stopped by cross-document back()"); 38 </script>