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 | <head> |
michael@0 | 4 | <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 7 | <script> |
michael@0 | 8 | var w; |
michael@0 | 9 | var counter = 0; |
michael@0 | 10 | |
michael@0 | 11 | function doNext() |
michael@0 | 12 | { |
michael@0 | 13 | counter++; |
michael@0 | 14 | postMessage("ohai", "*"); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function boom(event) |
michael@0 | 18 | { |
michael@0 | 19 | switch (counter) |
michael@0 | 20 | { |
michael@0 | 21 | case 1: |
michael@0 | 22 | w = window.open("data:text/html,1"); |
michael@0 | 23 | doNext(); |
michael@0 | 24 | return; |
michael@0 | 25 | case 2: |
michael@0 | 26 | w.location = "data:text/html,2"; |
michael@0 | 27 | function next() |
michael@0 | 28 | { |
michael@0 | 29 | w.history.back(); |
michael@0 | 30 | doNext(); |
michael@0 | 31 | } |
michael@0 | 32 | setTimeout(next, 5000); |
michael@0 | 33 | return; |
michael@0 | 34 | case 3: |
michael@0 | 35 | localStorage.setItem("key", "value"); |
michael@0 | 36 | w.history.forward(); |
michael@0 | 37 | doNext(); |
michael@0 | 38 | return; |
michael@0 | 39 | case 4: |
michael@0 | 40 | w.close(); |
michael@0 | 41 | ok(true, "Test complete"); |
michael@0 | 42 | SimpleTest.finish(); |
michael@0 | 43 | } |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | window.addEventListener("message", boom, false); |
michael@0 | 47 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 48 | |
michael@0 | 49 | </script> |
michael@0 | 50 | </head> |
michael@0 | 51 | <body onload="doNext();"></body> |
michael@0 | 52 | </html> |