Tue, 06 Jan 2015 21:39:09 +0100
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</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"> |
michael@0 | 9 | </script> |
michael@0 | 10 | <script type="application/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</a> |
michael@0 | 19 | <p id="display"></p> |
michael@0 | 20 | <div id="div"></div> |
michael@0 | 21 | <pre id="test"> |
michael@0 | 22 | <script type="application/javascript"> |
michael@0 | 23 | /* |
michael@0 | 24 | * Test for Bug 633602 |
michael@0 | 25 | * Tests full-screen-api.pointer-lock pref |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 29 | |
michael@0 | 30 | var div = document.getElementById("div") |
michael@0 | 31 | , prefEnabled = false |
michael@0 | 32 | , prefDisabled = false; |
michael@0 | 33 | |
michael@0 | 34 | function runTests () { |
michael@0 | 35 | ok(prefEnabled, "Element should be able to lock the pointer " + |
michael@0 | 36 | "if pointer-lock pref is set to TRUE"); |
michael@0 | 37 | ok(prefDisabled, "Element should NOT be able to lock the pointer " + |
michael@0 | 38 | "if pointer-lock pref is set to FALSE"); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | document.addEventListener("mozpointerlockchange", function (e) { |
michael@0 | 42 | if (document.mozPointerLockElement === div) { |
michael@0 | 43 | prefEnabled = true; |
michael@0 | 44 | document.mozExitPointerLock(); |
michael@0 | 45 | } |
michael@0 | 46 | else { |
michael@0 | 47 | SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled", |
michael@0 | 48 | false ); |
michael@0 | 49 | div.mozRequestPointerLock(); |
michael@0 | 50 | } |
michael@0 | 51 | }, false); |
michael@0 | 52 | |
michael@0 | 53 | document.addEventListener("mozpointerlockerror", function (e) { |
michael@0 | 54 | prefDisabled = true; |
michael@0 | 55 | document.mozCancelFullScreen(); |
michael@0 | 56 | }, false); |
michael@0 | 57 | |
michael@0 | 58 | document.addEventListener("mozfullscreenchange", function (e) { |
michael@0 | 59 | if (document.mozFullScreenElement === div) { |
michael@0 | 60 | SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled", |
michael@0 | 61 | true ); |
michael@0 | 62 | div.mozRequestPointerLock(); |
michael@0 | 63 | } |
michael@0 | 64 | else { |
michael@0 | 65 | SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled", |
michael@0 | 66 | true ); |
michael@0 | 67 | runTests(); |
michael@0 | 68 | SimpleTest.finish(); |
michael@0 | 69 | } |
michael@0 | 70 | }, false); |
michael@0 | 71 | |
michael@0 | 72 | function start() { |
michael@0 | 73 | div.mozRequestFullScreen(); |
michael@0 | 74 | } |
michael@0 | 75 | </script> |
michael@0 | 76 | </pre> |
michael@0 | 77 | </body> |
michael@0 | 78 | </html> |