tor-browser

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

document-fullscreen-enabled-setting-allowfullscreen.sub.html (1240B)


      1 <!DOCTYPE html>
      2 <title>Document#fullscreenEnabled setting allowfullscreen after load and then navigating</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id="log"></div>
      6 <script>
      7 async_test((t) => {
      8  const iframe = document.createElement('iframe');
      9  // no allowfullscreen attribute
     10 
     11  let i = 0;
     12 
     13  const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
     14  iframe.src = "http://{{hosts[][]}}:{{ports[http][0]}}" + path + "resources/echo-fullscreenEnabled.html";
     15  iframe.onload = t.step_func(() => {
     16    if (i === 0) {
     17      iframe.allowFullscreen = true;
     18    }
     19    iframe.contentWindow.postMessage('What is document.fullscreenEnabled?', '*');
     20  });
     21 
     22  window.onmessage = t.step_func((e) => {
     23    i++;
     24    if (i === 1) {
     25      assert_false(e.data, 'document.fullscreenEnabled in the iframe, before navigation');
     26 
     27      // Navigate the iframe. This will fire a second 'load' event on the iframe.
     28      iframe.contentWindow.location.href = iframe.src + '?2';
     29    } else {
     30      assert_true(e.data, 'document.fullscreenEnabled in the iframe, after navigation');
     31      t.done();
     32    }
     33  });
     34 
     35  document.body.appendChild(iframe);
     36 });
     37 </script>