tor-browser

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

iframe-loading-lazy-nav-meta-refresh.optional.html (1100B)


      1 <!DOCTYPE html>
      2 <title>Navigating iframe loading='lazy' before it is loaded: meta refresh</title>
      3 <!-- This test is optional because the spec allows delaying or doing nothing for meta refresh. -->
      4 <iframe src="support/blank.htm?src" loading="lazy" hidden></iframe>
      5 <script>
      6 const iframe = document.querySelector('iframe');
      7 const iframeLoaded = new Promise(resolve => {
      8  iframe.onload = resolve;
      9 });
     10 const meta = iframe.contentDocument.createElement('meta');
     11 meta.httpEquiv = 'Refresh';
     12 meta.content = '0; url=support/blank.htm?nav';
     13 iframe.contentDocument.head.append(meta);
     14 iframe.hidden = false;
     15 </script>
     16 <!-- Loading testharness.js here is intentional to reproduce a bug in WebKit. -->
     17 <script src="/resources/testharness.js"></script>
     18 <script src="/resources/testharnessreport.js"></script>
     19 <script>
     20 setup({single_test: true});
     21 iframeLoaded.then(() => {
     22  // Need a timeout to detect failure when there are two navigations.
     23  step_timeout(() => {
     24    assert_equals(iframe.contentWindow.location.href, new URL("support/blank.htm?nav", location.href).href);
     25    done();
     26  }, 1000);
     27 });
     28 </script>