tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cross-document-traversal-stop.html (1366B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Stop during cross-document traversals</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <!--
      8  The spec says that stop() must not stop traverals.
      9 
     10  (Note: the spec also says the UI "stop" button must not stop traversals, but
     11  that does not match browsers. See https://github.com/whatwg/html/issues/6905.
     12  But that is not what's under test here.)
     13 -->
     14 
     15 <body>
     16 <script type="module">
     17 import { createIframe, waitForLoad, delay } from "./resources/helpers.mjs";
     18 
     19 promise_test(async t => {
     20  const iframe = await createIframe(t);
     21 
     22  // Setup
     23  // Extra delay()s are necessary because if we navigate "inside" the load
     24  // handler (i.e. in a promise reaction for the load handler) then it will
     25  // be a replace navigation.
     26  iframe.contentWindow.location.search = "?1";
     27  await waitForLoad(iframe);
     28  await delay(t, 0);
     29  iframe.contentWindow.location.search = "?2";
     30  await waitForLoad(iframe);
     31  await delay(t, 0);
     32 
     33  iframe.contentWindow.history.back();
     34 
     35  assert_equals(iframe.contentWindow.location.search, "?2", "must not go back synchronously");
     36 
     37  window.stop();
     38 
     39  await waitForLoad(iframe);
     40  assert_equals(iframe.contentWindow.location.search, "?1", "must go back eventually");
     41 }, "cross-document traversals are not stopped by stop()");
     42 </script>