| <!DOCTYPE html> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| |
| <script> |
| async_test(t => { |
| // Wait for after the load event so that the navigation doesn't get converted |
| // into a replace navigation. |
| window.onload = () => t.step_timeout(() => { |
| assert_equals(appHistory.transition, null); |
| const from = appHistory.current; |
| const error = new Error("test"); |
| |
| appHistory.addEventListener("navigate", t.step_func(e => { |
| e.transitionWhile(Promise.reject(error)); |
| assert_equals(appHistory.transition, null); |
| })); |
| |
| let navigateerrorFired = false; |
| appHistory.addEventListener("navigateerror", t.step_func(() => { |
| navigateerrorFired = true; |
| |
| assert_equals(appHistory.transition.navigationType, "reload"); |
| assert_equals(appHistory.transition.from, from); |
| })); |
| |
| promise_rejects_exactly(t, error, appHistory.reload()).then(t.step_func_done(() => { |
| assert_equals(appHistory.transition, null); |
| assert_true(navigateerrorFired); |
| })); |
| |
| assert_equals(appHistory.transition.navigationType, "reload"); |
| assert_equals(appHistory.transition.from, from); |
| }, 0); |
| }, "transitionWhile()ed reload() with a rejected promise"); |
| </script> |