|
1 <html> |
|
2 <head> |
|
3 <script> |
|
4 document.childNodes.expando = "foo"; |
|
5 |
|
6 function getNodeList() { |
|
7 return document.childNodes; |
|
8 } |
|
9 function getOptions() { |
|
10 return document.createElement("select").options; |
|
11 } |
|
12 |
|
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 } |
|
22 |
|
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> |