transition-cross-document.html (1887B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 5 <iframe id="i" src="/common/blank.html"></iframe> 6 7 <script> 8 promise_test(async t => { 9 // Wait for after the load event so that the navigation doesn't get converted 10 // into a replace navigation. 11 await new Promise(r => window.onload = () => t.step_timeout(r, 0)); 12 13 i.contentWindow.navigation.onnavigatesuccess = t.unreached_func("navigatesuccess must not fire"); 14 i.contentWindow.navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); 15 16 assert_equals(i.contentWindow.navigation.transition, null); 17 i.contentWindow.navigation.reload(); 18 assert_equals(i.contentWindow.navigation.transition, null); 19 20 await new Promise(r => i.onload = () => t.step_timeout(r, 0)); 21 }, "cross-document reload() must leave transition null"); 22 23 promise_test(async t => { 24 i.contentWindow.navigation.onnavigatesuccess = t.unreached_func("navigatesuccess must not fire"); 25 i.contentWindow.navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); 26 27 assert_equals(i.contentWindow.navigation.transition, null); 28 i.contentWindow.navigation.navigate("?1"); 29 assert_equals(i.contentWindow.navigation.transition, null); 30 31 await new Promise(r => i.onload = () => t.step_timeout(r, 0)); 32 }, "cross-document navigate() must leave transition null"); 33 34 promise_test(async t => { 35 i.contentWindow.navigation.onnavigatesuccess = t.unreached_func("navigatesuccess must not fire"); 36 i.contentWindow.navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); 37 38 assert_equals(i.contentWindow.navigation.transition, null); 39 i.contentWindow.navigation.back(); 40 assert_equals(i.contentWindow.navigation.transition, null); 41 42 await new Promise(r => i.onload = r); 43 }, "cross-document back() must leave transition null"); 44 </script>