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 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | - http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 3 | <!-- bug 893785 - Test that sending a gamepadconnected event to a new window |
michael@0 | 4 | doesn't result in a gamepadconnected event being sent to existing |
michael@0 | 5 | windows that have already received it. --> |
michael@0 | 6 | <!DOCTYPE HTML> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <title>Test hidden frames</title> |
michael@0 | 10 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <script type="text/javascript" src="mock_gamepad.js"></script> |
michael@0 | 15 | <script class="testbody" type="text/javascript"> |
michael@0 | 16 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 17 | var index = GamepadService.addGamepad("test gamepad", // id |
michael@0 | 18 | SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING, |
michael@0 | 19 | 4, // buttons |
michael@0 | 20 | 2);// axes |
michael@0 | 21 | |
michael@0 | 22 | function pressButton() { |
michael@0 | 23 | GamepadService.newButtonEvent(index, 0, true); |
michael@0 | 24 | GamepadService.newButtonEvent(index, 0, false); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | var f1, f2; |
michael@0 | 28 | function frame_loaded() { |
michael@0 | 29 | f1 = document.getElementById('f1'); |
michael@0 | 30 | pressButton(); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | window.addEventListener("gamepadbuttondown", function() { |
michael@0 | 34 | // Wait to ensure that all frames received the button press as well. |
michael@0 | 35 | SpecialPowers.executeSoon(tests[testNum++]); |
michael@0 | 36 | }); |
michael@0 | 37 | |
michael@0 | 38 | var testNum = 0; |
michael@0 | 39 | var tests = [ |
michael@0 | 40 | test1, |
michael@0 | 41 | test2, |
michael@0 | 42 | ]; |
michael@0 | 43 | |
michael@0 | 44 | function test1() { |
michael@0 | 45 | is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1"); |
michael@0 | 46 | |
michael@0 | 47 | // Now add another frame. |
michael@0 | 48 | f2 = document.createElement("iframe"); |
michael@0 | 49 | f2.addEventListener("load", function() { |
michael@0 | 50 | // When the frame is loaded, press a button again. |
michael@0 | 51 | pressButton(); |
michael@0 | 52 | }); |
michael@0 | 53 | f2.src = "gamepad_frame.html"; |
michael@0 | 54 | document.body.appendChild(f2); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | function test2() { |
michael@0 | 58 | is(f1.contentWindow.connectedEvents, 1, "right number of connection events in frame 1"); |
michael@0 | 59 | is(f2.contentWindow.connectedEvents, 1, "right number of connection events in frame 2"); |
michael@0 | 60 | GamepadService.removeGamepad(index); |
michael@0 | 61 | SimpleTest.finish(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | </script> |
michael@0 | 65 | <iframe id="f1" src="gamepad_frame.html" onload="frame_loaded()"></iframe> |
michael@0 | 66 | </body> |
michael@0 | 67 | </html> |