Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
let start_length = navigation.entries().length;
let start_index = navigation.currentEntry.index;
// 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(() => {
let entry1 = navigation.currentEntry;
assert_true(entry1.sameDocument);
location = "#hash";
let entry2 = navigation.currentEntry;
assert_not_equals(entry1, entry2);
assert_true(entry1.sameDocument);
history.pushState("push", "", "#push");
let entry3 = navigation.currentEntry;
assert_not_equals(entry1, entry3);
assert_not_equals(entry2, entry3);
assert_true(entry1.sameDocument);
assert_true(entry2.sameDocument);
assert_equals(navigation.entries().length, start_length + 2);
assert_equals(navigation.entries()[start_index], entry1);
assert_equals(navigation.entries()[start_index + 1], entry2);
assert_equals(navigation.entries()[start_index + 2], entry3);
}), 0);
}, "entry.sameDocument after same-document navigations");
</script>