dom/tests/mochitest/general/file_moving_nodeList.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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