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=265203 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 265203</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=265203">Mozilla Bug 265203</a> |
michael@0 | 14 | <p id="display"> |
michael@0 | 15 | <a id="a1" href="http://www.mozilla.org">Mozilla</a><a id="a2" |
michael@0 | 16 | href="http://www.mozilla.org/products/firefox">Firefox</a><br> |
michael@0 | 17 | <br> |
michael@0 | 18 | <table cellpadding="2" cellspacing="2" border="1" |
michael@0 | 19 | style="text-align: left; width: 100%;"> |
michael@0 | 20 | <tbody> |
michael@0 | 21 | |
michael@0 | 22 | <tr> |
michael@0 | 23 | <td style="vertical-align: top;"><a id="a3" href="http://www.mozilla.org">Mozilla</a></td> |
michael@0 | 24 | <td style="vertical-align: top;"><a |
michael@0 | 25 | href="http://www.mozilla.org/products/firefox">Firefox</a></td> |
michael@0 | 26 | </tr> |
michael@0 | 27 | <tr> |
michael@0 | 28 | <td style="vertical-align: top;"><a href="http://www.mozilla.org">Mozilla</a></td> |
michael@0 | 29 | <td style="vertical-align: top;"><a |
michael@0 | 30 | href="http://www.mozilla.org/products/firefox">Firefox</a></td> |
michael@0 | 31 | |
michael@0 | 32 | </tr> |
michael@0 | 33 | </tbody> |
michael@0 | 34 | </table> |
michael@0 | 35 | </p> |
michael@0 | 36 | <div id="content" style="display: none"> |
michael@0 | 37 | |
michael@0 | 38 | </div> |
michael@0 | 39 | <pre id="test"> |
michael@0 | 40 | <script type="application/javascript"> |
michael@0 | 41 | |
michael@0 | 42 | /** Test for Bug 265203 **/ |
michael@0 | 43 | |
michael@0 | 44 | // Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown |
michael@0 | 45 | // events |
michael@0 | 46 | SpecialPowers.setBoolPref("snav.enabled", false); |
michael@0 | 47 | |
michael@0 | 48 | var gTestStarted = false; |
michael@0 | 49 | var expectedResult = [ null, 0, null ]; |
michael@0 | 50 | var nextTest; |
michael@0 | 51 | var test = 0; |
michael@0 | 52 | |
michael@0 | 53 | function testFocus() { |
michael@0 | 54 | var selection = window.getSelection() |
michael@0 | 55 | is(selection.focusNode, expectedResult[0],"test" + test + ": " + "caret node"); |
michael@0 | 56 | is(selection.focusOffset, expectedResult[1],"test" + test + ": " + "caret offset"); |
michael@0 | 57 | is(document.activeElement, expectedResult[2],"test" + test + ": " + "focused node"); |
michael@0 | 58 | ++test; |
michael@0 | 59 | if (nextTest) |
michael@0 | 60 | nextTest(); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function test0() { |
michael@0 | 64 | $("a1").focus(); |
michael@0 | 65 | expectedResult = [ $("a1"), 0, $("a1") ] |
michael@0 | 66 | nextTest = test1; |
michael@0 | 67 | testFocus(); |
michael@0 | 68 | } |
michael@0 | 69 | function test1() { |
michael@0 | 70 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 71 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 72 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 73 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 74 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 75 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 76 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 77 | expectedResult = [ $("a1").firstChild, 7, $("a2") ] |
michael@0 | 78 | nextTest = test2; |
michael@0 | 79 | testFocus(); |
michael@0 | 80 | } |
michael@0 | 81 | function test2() { |
michael@0 | 82 | $("a3").focus(); |
michael@0 | 83 | expectedResult = [ $("a3"), 0, $("a3") ] |
michael@0 | 84 | nextTest = test3; |
michael@0 | 85 | testFocus(); |
michael@0 | 86 | } |
michael@0 | 87 | function test3() { |
michael@0 | 88 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 89 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 90 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 91 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 92 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 93 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 94 | synthesizeKey("VK_RIGHT", { }); |
michael@0 | 95 | expectedResult = [ $("a3").firstChild, 7, $("a3") ] |
michael@0 | 96 | nextTest = SimpleTest.finish; |
michael@0 | 97 | testFocus(); |
michael@0 | 98 | } |
michael@0 | 99 | |
michael@0 | 100 | function startTest() { |
michael@0 | 101 | if (gTestStarted) |
michael@0 | 102 | return; |
michael@0 | 103 | gTestStarted = true; |
michael@0 | 104 | |
michael@0 | 105 | SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true]]}, test0); |
michael@0 | 106 | } |
michael@0 | 107 | |
michael@0 | 108 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 109 | SimpleTest.waitForFocus(startTest); |
michael@0 | 110 | |
michael@0 | 111 | </script> |
michael@0 | 112 | </pre> |
michael@0 | 113 | </body> |
michael@0 | 114 | </html> |