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.
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>localStorage cookies settings test</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 <script type="text/javascript">
10 SimpleTest.waitForExplicitFinish();
12 // Set cookies behavior to "always reject".
13 SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 2]]},
14 test1);
16 function test1() {
17 try {
18 localStorage.setItem("contentkey", "test-value");
19 ok(false, "Setting localStorageItem should throw a security exception");
20 }
21 catch(ex) {
22 is(ex.name, "SecurityError");
23 }
25 // Set cookies behavior to "ask every time".
26 SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy", 1]],
27 "clear": [["network.cookie.cookieBehavior"]]},
28 test2);
29 }
31 function test2() {
32 try {
33 localStorage.setItem("contentkey", "test-value");
34 ok(false, "Setting localStorageItem should throw a security exception");
35 }
36 catch(ex) {
37 is(ex.name, "SecurityError");
38 }
40 SimpleTest.finish();
41 }
43 </script>
44 </head>
45 <body>
46 </body>
47 </html>