dom/tests/mochitest/general/file_moving_nodeList.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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

mercurial