dom/tests/mochitest/pointerlock/file_targetOutOfFocus.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.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=633602
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Bug 633602 - file_targetOutOfFocus.html</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
michael@0 9 </script>
michael@0 10 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js">
michael@0 11 </script>
michael@0 12 <script type="application/javascript" src="pointerlock_utils.js"></script>
michael@0 13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 14 </head>
michael@0 15 <body>
michael@0 16 <a target="_blank"
michael@0 17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
michael@0 18 Mozilla Bug 633602
michael@0 19 </a>
michael@0 20 <p id="display"></p>
michael@0 21 <div id="content">
michael@0 22 </div>
michael@0 23 <div id="div"></div>
michael@0 24 <input id="input" type="text" />
michael@0 25 <pre id="test">
michael@0 26 <script type="application/javascript">
michael@0 27 /*
michael@0 28 * Test for Bug 633602
michael@0 29 * Element doesn't need to have focus to request
michael@0 30 * pointer lock
michael@0 31 */
michael@0 32
michael@0 33 SimpleTest.waitForExplicitFinish();
michael@0 34
michael@0 35 var div = document.getElementById("div")
michael@0 36 , input = document.getElementById("input")
michael@0 37 , divPointerLock = false;
michael@0 38
michael@0 39 function runTests () {
michael@0 40 ok(divPointerLock, "Pointer should be locked even if " +
michael@0 41 "the element being locked is not focused");
michael@0 42 }
michael@0 43
michael@0 44 input.addEventListener("focus", function() {
michael@0 45 div.mozRequestPointerLock();
michael@0 46 }, false);
michael@0 47
michael@0 48 document.addEventListener("mozpointerlockchange", function (e) {
michael@0 49 if (document.mozPointerLockElement === div) {
michael@0 50 divPointerLock = true;
michael@0 51 document.mozCancelFullScreen();
michael@0 52 }
michael@0 53 }, false);
michael@0 54
michael@0 55 document.addEventListener("mozfullscreenchange", function() {
michael@0 56 if (document.mozFullScreenElement === div) {
michael@0 57 input.focus();
michael@0 58 } else {
michael@0 59 runTests();
michael@0 60 SimpleTest.finish();
michael@0 61 }
michael@0 62 }, false);
michael@0 63
michael@0 64 function start() {
michael@0 65 div.mozRequestFullScreen();
michael@0 66 }
michael@0 67 </script>
michael@0 68 </pre>
michael@0 69 </body>
michael@0 70 </html>

mercurial