-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update AppHistory navigate event behavior for traversals
Follows WICG/navigation-api#178 * Always fire navigate event for traversals (currently, we fire it for all same-document traversals and for cross-document appHistory.goTo(), but not cross-document traversals from the legacy history API, or from the UI). * The AppHistory navigate event should never be cancelable for traversals. Previously, it was cancelable for renderer-initiated traversals, but this has the potential to cause problems in the case where multiple frames are navigating and one frame (but not all) cancels. That frame would be out of sync with the authoritative history state in the browser process. Change-Id: I92a3ee0f908acc04c31dc9b8ec57569bd66b4bc7
- Loading branch information
1 parent
5e22630
commit a5f4f5f
Showing
6 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app-history/navigate-event/navigate-history-back-cross-document.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!doctype html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="i" src="/common/blank.html"></iframe> | ||
<script> | ||
async_test(t => { | ||
window.onload = t.step_func(() => { | ||
let target_key = i.contentWindow.appHistory.current.key; | ||
let target_id = i.contentWindow.appHistory.current.id; | ||
i.contentWindow.appHistory.navigate("?foo"); | ||
i.onload = t.step_func(() => { | ||
i.contentWindow.appHistory.onnavigate = t.step_func_done(e => { | ||
assert_equals(e.navigationType, "traverse"); | ||
assert_false(e.cancelable); | ||
assert_false(e.canTransition); | ||
assert_false(e.userInitiated); | ||
assert_false(e.hashChange); | ||
assert_equals(new URL(e.destination.url).pathname, "/common/blank.html"); | ||
assert_false(e.destination.sameDocument); | ||
assert_equals(e.destination.key, target_key); | ||
assert_equals(e.destination.id, target_id); | ||
assert_equals(e.destination.index, 0); | ||
assert_equals(e.formData, null); | ||
assert_equals(e.info, undefined); | ||
}); | ||
assert_true(i.contentWindow.appHistory.canGoBack); | ||
i.contentWindow.history.back(); | ||
}) | ||
}); | ||
}, "navigate event for history.back() - cross-document"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters