Bug 1757847 [wpt PR 33036] - Update wpt metadata, a=testonly
[gecko.git] / testing / web-platform / tests / app-history / ordering-and-transition / location-href-canceled.html
blobf4247413d3aa2f325c920352c643857c0d09ca12
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
5 <script type="module">
6 import { Recorder } from "./resources/helpers.mjs";
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));
13 const recorder = new Recorder({
14 finalExpectedEvent: "promise microtask"
15 });
17 recorder.setUpAppHistoryListeners();
19 navigation.addEventListener("navigate", t.step_func(e => {
20 e.preventDefault();
21 }));
23 location.href = "/common/blank.html#1";
25 Promise.resolve().then(() => recorder.record("promise microtask"));
27 await recorder.readyToAssert;
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 ]);
37 recorder.assertErrorsAreAbortErrors();
38 }, "event and promise ordering for the location.href setter where the navigate event is canceled");
39 </script>