tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

iframe-loading-lazy-nav-location-assign.html (919B)


      1 <!DOCTYPE html>
      2 <title>Navigating iframe loading='lazy' before it is loaded: location.assign</title>
      3 <iframe data-src="support/blank.htm?nav" 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 iframe.contentWindow.location.assign(iframe.dataset.src);
     10 iframe.hidden = false;
     11 </script>
     12 <!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. -->
     13 <script src="/resources/testharness.js"></script>
     14 <script src="/resources/testharnessreport.js"></script>
     15 <script>
     16 setup({single_test: true});
     17 iframeLoaded.then(() => {
     18  // Need a timeout to detect failure when there are two navigations.
     19  step_timeout(() => {
     20    assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href);
     21    done();
     22  }, 1000);
     23 });
     24 </script>