OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="resources/WindowProperties.js"></script> | 4 <script src="resources/WindowProperties.js"></script> |
5 <script> | 5 <script> |
6 if (window.testRunner) | 6 if (window.testRunner) |
7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
8 | 8 |
9 function log(message, color) | 9 function log(message, color) |
10 { | 10 { |
11 var paragraph = document.createElement("div"); | 11 var paragraph = document.createElement("div"); |
12 paragraph.appendChild(document.createTextNode(message)); | 12 paragraph.appendChild(document.createTextNode(message)); |
13 paragraph.style.fontFamily = "monospace"; | 13 paragraph.style.fontFamily = "monospace"; |
14 if (color) | 14 if (color) |
15 paragraph.style.color = color; | 15 paragraph.style.color = color; |
16 document.getElementById("console").appendChild(paragraph); | 16 document.getElementById("console").appendChild(paragraph); |
17 } | 17 } |
18 | 18 |
19 function shouldBe(a, b, printOnlyOnFailure) | 19 function shouldBe(a, b, printOnlyOnFailure) |
(...skipping 11 matching lines...) Expand all Loading... |
31 log("FAIL: " + a + " should be " + b + " but instead is " + eval
A, "red"); | 31 log("FAIL: " + a + " should be " + b + " but instead is " + eval
A, "red"); |
32 } | 32 } |
33 | 33 |
34 function testFunction(functionName) | 34 function testFunction(functionName) |
35 { | 35 { |
36 var iframe = document.createElement('iframe'); | 36 var iframe = document.createElement('iframe'); |
37 iframe.src = "about:blank"; | 37 iframe.src = "about:blank"; |
38 iframe.name = functionName; | 38 iframe.name = functionName; |
39 document.body.appendChild(iframe); | 39 document.body.appendChild(iframe); |
40 | 40 |
41 shouldBe("typeof window." + functionName, "object"); | 41 shouldBe("typeof window." + functionName, "function"); |
42 | 42 |
43 document.body.removeChild(iframe); | 43 document.body.removeChild(iframe); |
44 } | 44 } |
45 | 45 |
46 function runTests() | 46 function runTests() |
47 { | 47 { |
48 for (var func in windowFunctions) { | 48 for (var func in windowFunctions) { |
49 testFunction(windowFunctions[func]) | 49 testFunction(windowFunctions[func]) |
50 } | 50 } |
51 | 51 |
52 window.myFunction = function() { return "myFunction"; } | 52 window.myFunction = function() { return "myFunction"; } |
53 testFunction("myFunction"); | 53 testFunction("myFunction"); |
54 window.__proto__.myPrototypeFunction = function() { return "myProtot
ypeFunction"; } | 54 window.__proto__.myPrototypeFunction = function() { return "myProtot
ypeFunction"; } |
55 testFunction("myPrototypeFunction"); | 55 testFunction("myPrototypeFunction"); |
56 } | 56 } |
57 </script> | 57 </script> |
58 </head> | 58 </head> |
59 <body onload="runTests();"> | 59 <body onload="runTests();"> |
60 <p>This tests that a frame with a the same name as function on the window ob
ject, has precedence in the lookup.</p> | 60 <p>This tests that functions of the window object and it's prototype have pr
ecedence in lookup over frames with name's of the same name.</p> |
61 <pre id="console"></pre> | 61 <pre id="console"></pre> |
62 </body> | 62 </body> |
63 </html> | 63 </html> |
OLD | NEW |