tor-browser

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

location-href-canceled.html (1176B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 
      5 <script type="module">
      6 import { Recorder } from "./resources/helpers.mjs";
      7 
      8 promise_test(async t => {
      9  // Wait for after the load event so that the navigation doesn't get converted
     10  // into a replace navigation.
     11  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     12 
     13  const recorder = new Recorder({
     14    finalExpectedEvent: "promise microtask"
     15  });
     16 
     17  recorder.setUpNavigationAPIListeners();
     18 
     19  navigation.addEventListener("navigate", t.step_func(e => {
     20    e.preventDefault();
     21  }));
     22 
     23  location.href = "/common/blank.html#1";
     24 
     25  Promise.resolve().then(() => recorder.record("promise microtask"));
     26 
     27  await recorder.readyToAssert;
     28 
     29  recorder.assert([
     30    /* event name, location.hash value, navigation.transition properties */
     31    ["navigate", "", null],
     32    ["AbortSignal abort", "", null],
     33    ["navigateerror", "", null],
     34    ["promise microtask", "", null]
     35  ]);
     36 
     37  recorder.assertErrorsAreAbortErrors();
     38 }, "event and promise ordering for the location.href setter where the navigate event is canceled");
     39 </script>