tor-browser

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

file_locksvgelement.html (1832B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <!--
      4  https://bugzilla.mozilla.org/show_bug.cgi?id=633602
      5  -->
      6  <head>
      7    <title>Bug 633602</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</a>
     19    <p id="display"></p>
     20 
     21    <svg id="svg-elem" width="100" height="100" viewbox="0 0 100 100">
     22        <rect x="10" y="10" width="50" height="50"
     23        fill="black" stroke="blue" stroke-width="2"/>
     24    </svg>
     25 
     26    <pre id="test">
     27      <script type="application/javascript">
     28        /*
     29         * Test for Bug 633602
     30         * Test locking non-html element.
     31         */
     32 
     33        SimpleTest.waitForExplicitFinish(1);
     34 
     35        var elem,
     36          elemWasLocked = false;
     37 
     38        document.addEventListener("pointerlockchange", function (e) {
     39          if (document.fullscreenElement &&
     40              document.pointerLockElement === elem) {
     41            elemWasLocked = true;
     42            document.exitPointerLock();
     43          } else {
     44            addFullscreenChangeContinuation("exit", function() {
     45              ok(elemWasLocked, "Expected SVG elem to become locked.");
     46              SimpleTest.finish();
     47            });
     48            document.exitFullscreen();
     49          }
     50        });
     51 
     52        function start() {
     53          elem = document.getElementById("svg-elem");
     54          addFullscreenChangeContinuation("enter", function() {
     55            elem.requestPointerLock();
     56          });
     57          elem.requestFullscreen();
     58        }
     59      </script>
     60    </pre>
     61  </body>
     62 </html>