dom/tests/mochitest/pointerlock/file_escapeKey.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 <!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
     4 <head>
     5   <title>Bug 633602</title>
     6   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
     7   </script>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
     9   </script>
    10   <script type="application/javascript" src="pointerlock_utils.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    12 </head>
    13 <body>
    14   <a target="_blank"
    15     href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
    16     Mozilla Bug 633602
    17   </a>
    18   <div id="div"></div>
    19   <pre id="test">
    20     <script type="text/javascript">
    21       /*
    22        * Test for Bug 633602
    23        * Escape key should unlock the pointer
    24        */
    26       SimpleTest.waitForExplicitFinish();
    28       var div = document.getElementById("div")
    29         , pointerUnLocked = false;
    31       function runTests () {
    32         ok(pointerUnLocked, "Pressing Escape key should unlock the pointer");
    33       }
    35       document.addEventListener("mozpointerlockchange", function (e) {
    36         if (document.mozPointerLockElement === div) {
    37           synthesizeKey("VK_ESCAPE", {});
    38         }
    39         else {
    40           pointerUnLocked = true;
    41           document.mozCancelFullScreen();
    42         }
    43       }, false);
    45       document.addEventListener("mozfullscreenchange", function(e) {
    46         if (document.mozFullScreenElement === div) {
    47           div.mozRequestPointerLock();
    48         }
    49         else {
    50           runTests();
    51           SimpleTest.finish();
    52         }
    53       }, false);
    55       function start() {
    56         div.mozRequestFullScreen();
    57       }
    58     </script>
    59   </pre>
    60 </body>
    61 </html>

mercurial