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>
2 <head>
3 <script>
4 document.childNodes.expando = "foo";
6 function getNodeList() {
7 return document.childNodes;
8 }
9 function getOptions() {
10 return document.createElement("select").options;
11 }
13 function tryToUseNodeList(nodeList, ok) {
14 function expectException(op, reason) {
15 try {
16 var result = op();
17 ok(false, "should have thrown an exception, got: " + result);
18 } catch (e) {
19 ok(/Permission denied/.test(e.toString()), reason);
20 }
21 }
23 expectException(function() { nodeList.length = 2; }, "should not be able to set attributes");
24 expectException(function() { nodeList.item(0); }, "should not have access to any functions");
25 expectException(function() { nodeList.foo = "foo"; }, "should not be able to add expandos");
26 }
27 </script>
28 </head>
29 <body>
30 </body>
31 </html>