beforeunload-sticky-activation-iframe.html (826B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Beforeunload must be gated behind sticky activation: nested browsing context</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <p>If you happen to be running this test as a human, then be sure not to interact with any part of the page; that would invalidate the results! 8 9 <script> 10 setup({ single_test: true }); 11 12 const iframe = document.createElement('iframe'); 13 iframe.src = 'support/beforeunload-sticky-start.html'; 14 15 window.onmessage = e => { 16 assert_equals(e.data, 'navigated successfully'); 17 18 const desiredURL = (new URL('support/beforeunload-sticky-destination.html', location.href)).href; 19 assert_equals(iframe.contentWindow.location.href, desiredURL); 20 21 done(); 22 }; 23 24 document.body.append(iframe); 25 </script>