OLD | NEW |
| (Empty) |
1 <html> | |
2 <head></head> | |
3 <body> | |
4 | |
5 <p> | |
6 This test checks the behavior of dom operations when called on non-dom | |
7 or incompatible receivers with non-dom or incompatible arguments. | |
8 </p> | |
9 | |
10 <script> | |
11 if (window.layoutTestController) layoutTestController.dumpAsText(); | |
12 | |
13 function addResult(str) { | |
14 var option = document.createElement("option"); | |
15 option.innerHTML = str; | |
16 document.getElementById("results").appendChild(option); | |
17 } | |
18 | |
19 function trySuspect(name, fun) { | |
20 try { | |
21 result = fun(); | |
22 document.write(name + " = " + result + "<br />"); | |
23 } catch (e) { | |
24 document.write(name + ": " + e + "<br />"); | |
25 } | |
26 } | |
27 | |
28 var aDOMImplementation = document.implementation; | |
29 var aSelect = document.createElement("select"); | |
30 var anOption = document.createElement("option"); | |
31 | |
32 document.write("DOMImplementation: " + aDOMImplementation + "<br />"); | |
33 var aNode = document.createElement("div"); | |
34 var aSecondNode = document.createElement("div"); | |
35 aNode.appendChild(aSecondNode); | |
36 | |
37 trySuspect("Node::appendChild(DOMImplementation)", function () { | |
38 return aNode.appendChild(aDOMImplementation); | |
39 }); | |
40 | |
41 trySuspect("Node::appendChild(String)", function () { | |
42 return aNode.appendChild("knort"); | |
43 }); | |
44 | |
45 trySuspect("Node::appendChild(undefined)", function () { | |
46 return aNode.appendChild(void 0); | |
47 }); | |
48 | |
49 trySuspect("Node::isSameNode(DOMImplementation)", function () { | |
50 return aNode.isSameNode(aDOMImplementation); | |
51 }); | |
52 | |
53 trySuspect("Node::isSameNode(String)", function () { | |
54 return aNode.isSameNode("foo"); | |
55 }); | |
56 | |
57 trySuspect("Node::isSameNode(undefined)", function () { | |
58 return aNode.isSameNode(void 0); | |
59 }); | |
60 | |
61 trySuspect("Node::lookupPrefix(DOMImplementation)", function () { | |
62 return aNode.lookupPrefix(aDOMImplementation); | |
63 }); | |
64 | |
65 trySuspect("Node::lookupPrefix(undefined)", function () { | |
66 return aNode.lookupPrefix(void 0); | |
67 }); | |
68 | |
69 trySuspect("Node::cloneNode(DOMImplementation)", function () { | |
70 return aNode.cloneNode(aDOMImplementation); | |
71 }); | |
72 | |
73 trySuspect("Select::add(DOMImplementation, DOMImplementation)", function () { | |
74 return aSelect.add(aDOMImplementation, aDOMImplementation); | |
75 }); | |
76 | |
77 trySuspect("Select::add(DOMImplementation, Option)", function () { | |
78 return aSelect.add(aDOMImplementation, anOption); | |
79 }); | |
80 | |
81 trySuspect("Select::add(Option, DOMImplementation)", function () { | |
82 return aSelect.add(anOption, aDOMImplementation); | |
83 }); | |
84 | |
85 trySuspect("Select::add(undefined, undefined)", function () { | |
86 return aSelect.add(void 0, void 0); | |
87 }); | |
88 | |
89 trySuspect("Select::add(undefined, Option)", function () { | |
90 return aSelect.add(void 0, anOption); | |
91 }); | |
92 | |
93 trySuspect("Select::add(Option, undefined)", function () { | |
94 return aSelect.add(anOption, void 0); | |
95 }); | |
96 | |
97 </script> | |
98 </body> | |
99 </html> | |
OLD | NEW |