activation-traverse-not-in-entries.html (1706B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="/common/blank.html"></iframe> 5 <script src="/common/get-host-info.sub.js"></script> 6 <script> 7 promise_test(async t => { 8 // Wait for after the load event so that the navigation doesn't get converted 9 // into a replace navigation. 10 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 11 12 i.contentWindow.location = get_host_info().HTTP_ORIGIN_WITH_DIFFERENT_PORT + "/common/blank.html"; 13 await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); 14 15 i.contentWindow.location = get_host_info().HTTP_ORIGIN + "/common/blank.html"; 16 await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); 17 18 // Go back to the first entry in the iframe. Because the navigation API only 19 // exposes same-origin *contiguous* entries, and there's a cross-origin entry 20 // in between, we have to use history.go(). 21 history.go(-2); 22 await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); 23 assert_equals(i.contentWindow.navigation.entries().length, 1); 24 25 // activation.from will be null because the entry that triggered the traversal 26 // is in a different same-origin contiguous region. 27 assert_equals(i.contentWindow.navigation.activation.entry, i.contentWindow.navigation.currentEntry); 28 assert_equals(i.contentWindow.navigation.activation.entry.index, 0); 29 assert_equals(i.contentWindow.navigation.activation.from, null); 30 assert_equals(i.contentWindow.navigation.activation.navigationType, "traverse"); 31 }, "navigation.activation - traverse from a non-contiguous same-origin url"); 32 </script>