tor-browser

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

move-to-inactive-document.html (1233B)


      1 <!DOCTYPE html>
      2 <title>Move the fullscreen element to an inactive document</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="../trusted-click.js"></script>
      8 <div></div>
      9 <script>
     10  promise_test(async (t) => {
     11    t.add_cleanup(() => {
     12      if (document.fullscreenElement) {
     13        return document.exitFullscreen();
     14      }
     15    });
     16    const div = document.querySelector("div");
     17 
     18    // Go fullscreen...
     19    await Promise.all([trusted_request(div), fullScreenChange()]);
     20 
     21    const inactiveDocument = document.implementation.createDocument(null, "");
     22 
     23    div.onfullscreenchange = t.unreached_func(
     24      "fullscreenchange fired on element"
     25    );
     26    inactiveDocument.onfullscreenchange = t.unreached_func(
     27      "fullscreenchange fired on other document"
     28    );
     29 
     30    // Transplant element to inactive document...
     31    inactiveDocument.appendChild(div);
     32 
     33    // Fullscreen exits...
     34    await fullScreenChange();
     35    // Make sure no other events fire...
     36    await new Promise((resolve) => {
     37      requestAnimationFrame(resolve);
     38    });
     39  });
     40 </script>