Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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> |