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>Storage interface</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 function startTest()
11 {
12 var functionCalled = false;
13 is(localStorage instanceof Storage, true, "localStorage is instance of Storage");
14 Storage.prototype.exists = function(key) {
15 functionCalled = true;
16 return this.getItem(key) != null;
17 }
18 localStorage.setItem("test_prototype", "value");
19 is(functionCalled, false, "Overridden function not called");
20 is(localStorage.exists("test_prototype"), true, "Prototype overridden");
21 is(functionCalled, true, "Overridden function called");
22 localStorage.clear();
24 SimpleTest.finish();
25 }
27 SimpleTest.waitForExplicitFinish();
29 </script>
31 </head>
33 <body onload="startTest();">
34 </body>
35 </html>