fune/testing/web-platform/tests/navigation-api/navigation-history-entry/index-not-in-entries.html
Domenic Denicola ea65c3eb84 Bug 1762480 [wpt PR 33461] - Navigation API: change { replace } to { history }, a=testonly
Automatic update from web-platform-tests
Navigation API: change { replace } to { history }

Follows https://github.com/WICG/navigation-api/pull/219.

Bug: 1183545
Change-Id: I1e962de093ece36c0f4cdebfcf83a53b4910ea16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3564502
Reviewed-by: Nate Chapin <japhet@chromium.org>
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988142}

--

wpt-commits: b905dcaacc78838e9b0a70de4aa7ca9735e2b726
wpt-pr: 33461
2022-04-11 07:45:03 +00:00

24 lines
928 B
HTML

<!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 => {
// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
window.onload = () => t.step_timeout(t.step_func_done(() => {
// Remove the entry by replacing it.
let replaced_entry = navigation.currentEntry;
assert_equals(replaced_entry.index, 0);
navigation.navigate("#0", { history: "replace" });
assert_equals(replaced_entry.index, -1);
// Remove the entry by detaching its window.
let iframe_entry = i.contentWindow.navigation.currentEntry;
assert_equals(iframe_entry.index, 0);
i.remove();
assert_equals(iframe_entry.index, -1);
t.done();
}), 0);
}, "entry.index should return -1 when not in navigation.entries()");
</script>