iframe-loading-lazy-nav-form-submit.html (1090B)
1 <!DOCTYPE html> 2 <title>Navigating iframe loading='lazy' before it is loaded: form submit</title> 3 <iframe name="iframe" src="support/blank.htm?src" loading="lazy" hidden></iframe> 4 <form action="support/blank.htm" target="iframe"></form> 5 <script> 6 const iframe = document.querySelector('iframe'); 7 const iframeLoaded = new Promise(resolve => { 8 iframe.onload = resolve; 9 }); 10 const form = document.querySelector('form'); 11 form.submit(); 12 iframe.hidden = false; 13 </script> 14 <!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. --> 15 <script src="/resources/testharness.js"></script> 16 <script src="/resources/testharnessreport.js"></script> 17 <script> 18 setup({single_test: true}); 19 iframeLoaded.then(() => { 20 // Need a timeout to detect failure when there are two navigations. 21 step_timeout(() => { 22 // The "?" in the URL is there because the default method is "GET" 23 // and the form data (empty here) is populated into the query. 24 assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?", location.href).href); 25 done(); 26 }, 1000); 27 }); 28 </script>