dom/tests/mochitest/pointerlock/file_locksvgelement.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
     9     </script>
    10     <script type="application/javascript" 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>
    21     <svg width="100" height="100" viewbox="0 0 100 100">
    22         <rect id="svg-elem" x="10" y="10" width="50" height="50"
    23         fill="black" stroke="blue" stroke-width="2"/>
    24     </svg>
    26     <pre id="test">
    27       <script type="application/javascript">
    28         /*
    29          * Test for Bug 633602
    30          * Test locking non-html element.
    31          */
    33         SimpleTest.waitForExplicitFinish(1);
    35         var elem,
    36           elemWasLocked = false;
    38         document.addEventListener("mozpointerlockchange", function (e) {
    39           if (document.mozFullScreen &&
    40               document.mozPointerLockElement === elem) {
    41             elemWasLocked = true;
    42             document.mozExitPointerLock();
    43           } else {
    44             document.mozCancelFullScreen();
    45           }
    46         }, false);
    48         document.addEventListener("mozfullscreenchange", function (e) {
    49           if (document.mozFullScreenElement === elem) {
    50             elem.mozRequestPointerLock();
    51           } else {
    52             ok(elemWasLocked, "Expected SVG elem to become locked.");
    53             SimpleTest.finish();
    54           }
    55         }, false);
    57         function start() {
    58           elem = document.getElementById("svg-elem");
    59           elem.mozRequestFullScreen();
    60         }
    61       </script>
    62     </pre>
    63   </body>
    64 </html>

mercurial