| <!doctype html> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <iframe id="i" src="/common/blank.html"></iframe> |
| <script> |
| promise_test(async t => { |
| await new Promise(resolve => window.onload = resolve); |
| |
| let oncurrentchange_called = false; |
| let original_entry = i.contentWindow.appHistory.current; |
| i.contentWindow.appHistory.oncurrentchange = t.step_func(e => { |
| oncurrentchange_called = true; |
| assert_equals(e.from, original_entry); |
| assert_equals(e.from.index, -1); |
| assert_equals(e.navigationType, "replace"); |
| assert_equals(i.contentWindow.appHistory.current.index, 0); |
| }); |
| i.contentWindow.appHistory.onnavigate = e => e.transitionWhile(Promise.resolve()); |
| let result = i.contentWindow.appHistory.navigate("/common/blank.html?1", { replace: true }); |
| assert_true(oncurrentchange_called); |
| await result.committed; |
| }, "AppHistoryCurrentChangeEvent fires for appHistory.navigate() with replace intercepted by transitionWhile"); |
| </script> |