iframe-loading-lazy-reload-location-reload.html (908B)
1 <!DOCTYPE html> 2 <title>Reloading iframe loading='lazy' before it is loaded: location.reload</title> 3 <iframe src="support/blank.htm?src" loading="lazy" hidden></iframe> 4 <script> 5 const iframe = document.querySelector('iframe'); 6 const iframeLoaded = new Promise(resolve => { 7 iframe.onload = resolve; 8 }); 9 // Should have no effect on lazy-loading 10 iframe.contentWindow.location.reload(); 11 iframe.hidden = false; 12 </script> 13 <!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. --> 14 <script src="/resources/testharness.js"></script> 15 <script src="/resources/testharnessreport.js"></script> 16 <script> 17 setup({single_test: true}); 18 iframeLoaded.then(() => { 19 // Need a timeout to detect failure when there are two navigations. 20 step_timeout(() => { 21 assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?src", location.href).href); 22 done(); 23 }, 1000); 24 }); 25 </script>