2 <script src=
"/resources/testharness.js"></script>
3 <script src=
"/resources/testharnessreport.js"></script>
4 <script src=
"resources/helpers.js"></script>
7 promise_test(async t
=> {
8 // Wait for after the load event so that the navigation doesn't get converted
9 // into a replace navigation.
10 await
new Promise(resolve
=> window
.onload
= () => t
.step_timeout(resolve
, 0));
12 const key0
= navigation
.currentEntry
.key
;
16 assert_equals(navigation
.entries().length
, 2);
17 const [entry0
, entry1
] = navigation
.entries();
18 assert_equals((new URL(entry0
.url
)).hash
, "");
19 assert_equals((new URL(entry1
.url
)).hash
, "#1");
21 const err
= new Error("boo!");
22 const promise
= Promise
.reject(err
);
23 promise
.catch(() => {}); // prevent unhandled rejection testharness.js errors
24 navigation
.onnavigate
= e
=> e
.transitionWhile(promise
);
26 const result
= navigation
.traverseTo(key0
);
27 await
assertCommittedFulfillsFinishedRejectsExactly(t
, result
, entry0
, err
);
28 assert_equals(navigation
.currentEntry
, entry0
);
29 }, "traverseTo() promise rejection with rejected transitionWhile()");