Bug 1760181 [wpt PR 33182] - App history API to navigation API rename (2/n), a=testonly
[gecko.git] / testing / web-platform / tests / navigation-api / navigate-event / transitionWhile-reject.html
blob2cdea05072911cf6883f90071547f20b5693c01a
1 <!doctype html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script>
5 async_test(t => {
6 const err = new TypeError("a message");
7 let start_href = location.href;
9 navigation.onnavigatesuccess = t.step_func_done(assert_unreached);
10 navigation.onnavigateerror = t.step_func_done(e => {
11 assert_equals(location.hash, "#1");
12 assert_equals(e.constructor, ErrorEvent);
13 assert_true(e.error === err);
14 assert_equals(e.message, "Uncaught TypeError: a message");
15 assert_equals(e.filename, start_href);
16 assert_greater_than(e.colno, 0);
17 assert_greater_than(e.lineno, 0);
18 });
19 navigation.onnavigate = e => {
20 e.transitionWhile(new Promise((resolve, reject) => t.step_timeout(() => reject(err), 0)));
23 location.href = "#1";
24 assert_equals(location.hash, "#1");
25 }, "AppHistoryNavigateEvent's transitionWhile() should abort if the given promise rejects");
26 </script>