tor-browser

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

navigate-cross-document-double.html (1714B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <iframe id="i"></iframe>
      5 
      6 
      7 <script type="module">
      8 import { Recorder } from "./resources/helpers.mjs";
      9 
     10 promise_test(async t => {
     11  await new Promise(resolve => {
     12    i.src = "/common/blank.html";
     13    i.onload = () => t.step_timeout(resolve, 0)
     14  });
     15 
     16  const fromStart = i.contentWindow.navigation.currentEntry;
     17 
     18  const recorder = new Recorder({
     19    window: i.contentWindow,
     20    finalExpectedEvent: "promise microtask"
     21  });
     22 
     23  recorder.setUpNavigationAPIListeners();
     24 
     25  // Use https://web-platform-tests.org/writing-tests/server-pipes.html to make
     26  // sure the response doesn't come back quickly, since once the response comes
     27  // back the page would be unloaded and that would break our test.
     28  const result1 = i.contentWindow.navigation.navigate("?pipe=trickle(d100)");
     29  recorder.setUpResultListeners(result1, " 1");
     30 
     31  const result2 = i.contentWindow.navigation.navigate("?2");
     32  recorder.setUpResultListeners(result2, " 2");
     33 
     34  Promise.resolve().then(() => recorder.record("promise microtask"));
     35 
     36  await recorder.readyToAssert;
     37 
     38  recorder.assert([
     39    /* event name, location.hash value, navigation.transition properties */
     40    ["navigate", "", null],
     41    ["AbortSignal abort", "", null],
     42    ["navigateerror", "", null],
     43 
     44    ["navigate", "", null],
     45    ["committed rejected 1", "", null],
     46    ["finished rejected 1", "", null],
     47    ["promise microtask", "", null]
     48  ]);
     49 
     50  recorder.assertErrorsAreAbortErrors();
     51 }, "event and promise ordering when navigate() is called to a cross-document destination, interrupting another navigate() to a cross-document destination");
     52 </script>