entries-after-navigations-in-multiple-windows.html (1442B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="resources/is_uuid.js"></script> 5 <iframe id="i" src="/common/blank.html"></iframe> 6 <script> 7 async_test(t => { 8 let start_index = navigation.currentEntry.index; 9 // The navigations in each window should have only added an navigation to 10 // their own window. 11 function assertExpectedEntries(entries, expected_url) { 12 assert_equals(entries.length, 2); 13 assert_not_equals(entries[1].key, entries[0].key); 14 assert_not_equals(entries[1].url, entries[0].url); 15 assert_not_equals(entries[1].id, entries[0].id); 16 assert_true(isUUID(entries[0].key)); 17 assert_true(isUUID(entries[0].id)); 18 assert_true(isUUID(entries[1].key)); 19 assert_true(isUUID(entries[1].id)); 20 21 assert_equals(entries[1].url, expected_url); 22 } 23 24 // Wait for after the load event so that the navigation doesn't get converted 25 // into a replace navigation. 26 window.onload = () => t.step_timeout(t.step_func(() => { 27 location.hash = "#1"; 28 i.onload = t.step_func_done(() => { 29 assertExpectedEntries(navigation.entries().slice(start_index), location.href); 30 assertExpectedEntries(i.contentWindow.navigation.entries(), i.contentWindow.location.href); 31 }); 32 i.contentWindow.location = "/common/blank.html?2"; 33 }), 0); 34 }, "navigation.entries() behavior when multiple windows navigate."); 35 </script>