pageswap-initial-navigation.html (952B)
1 <!DOCTYPE HTML> 2 <title>Tests pageswap dispatch on initial doc navigation</title> 3 <link rel="author" title="Khushal Sagar" href="mailto:khushalsagar@chromium.org"> 4 <link rel="help" href="https://html.spec.whatwg.org/"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script> 10 setup({explicit_done: true}); 11 12 function runTest(frame) { 13 let frameWindow = frame.contentWindow; 14 15 let pageswapfired = false; 16 frameWindow.onpageswap = (e) => { 17 pageswapfired = true; 18 } 19 20 frameWindow.onpagehide = (e) => { 21 assert_true(pageswapfired, 'pageswap fired'); 22 done(); 23 } 24 25 frame.srcdoc = '<html></html>'; 26 } 27 28 promise_test(async t => { 29 onload = () => { 30 let frame = document.createElement('iframe'); 31 document.body.appendChild(frame); 32 runTest(frame); 33 }; 34 }); 35 </script>