tor-browser

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

file_nestedFullScreen.html (2439B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <!--
      4  https://bugzilla.mozilla.org/show_bug.cgi?id=633602
      5  -->
      6  <head>
      7    <title>Bug 633602 - file_nestedFullScreen.html</title>
      8    <script src="/tests/SimpleTest/SimpleTest.js">
      9    </script>
     10    <script src="/tests/SimpleTest/EventUtils.js">
     11    </script>
     12    <script type="application/javascript" src="pointerlock_utils.js"></script>
     13    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     14  </head>
     15  <body>
     16    <a target="_blank"
     17       href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
     18      Mozilla Bug 633602
     19    </a>
     20 
     21    <div id="parentDiv">
     22      <div id="childDiv"></div>
     23    </div>
     24 
     25    <script type="application/javascript">
     26      /*
     27       * Test for Bug 633602
     28       * Requesting fullscreen on a child element of the element with
     29       * the pointer locked should unlock the pointer
     30       */
     31 
     32      SimpleTest.waitForExplicitFinish();
     33 
     34      var parentDiv = document.getElementById("parentDiv")
     35        , childDiv = document.getElementById("childDiv")
     36        , parentDivLocked = false
     37        , parentDivFullScreen = false
     38        , pointerLocked = false;
     39 
     40      function runTests () {
     41        ok(parentDivLocked, "After requesting pointerlock on parentDiv " +
     42          "document.pointerLockElement should be equal to " +
     43          " parentDiv element");
     44        isnot(pointerLocked, true, "Requesting fullscreen on " +
     45          "childDiv while parentDiv still in fullscreen should " +
     46          "unlock the pointer");
     47      }
     48 
     49      document.addEventListener("pointerlockchange", function (e) {
     50        if (document.pointerLockElement === parentDiv) {
     51          parentDivLocked = true;
     52          addFullscreenChangeContinuation("enter", function() {
     53            pointerLocked = !!document.pointerLockElement;
     54            addFullscreenChangeContinuation("exit", function() {
     55              addFullscreenChangeContinuation("exit", function() {
     56                runTests();
     57                SimpleTest.finish();
     58              });
     59              document.exitFullscreen();
     60            });
     61            document.exitFullscreen();
     62          });
     63          childDiv.requestFullscreen();
     64        }
     65      });
     66 
     67      function start() {
     68        addFullscreenChangeContinuation("enter", function() {
     69          parentDivFullScreen = true;
     70          parentDiv.requestPointerLock();
     71        });
     72        parentDiv.requestFullscreen();
     73      }
     74    </script>
     75  </body>
     76 </html>