| 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 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } else | 30 } else |
| 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 element = document.createElement('div'); | 36 var element = document.createElement('div'); |
| 37 element.id = functionName; | 37 element.id = functionName; |
| 38 document.body.appendChild(element); | 38 document.body.appendChild(element); |
| 39 | 39 |
| 40 // showModalDialog only works on mac in the DRT. So run this test o
nly if its defined and print output only on failure. | 40 shouldBe("typeof window." + functionName, "function"); |
| 41 // This'll keep the output consistent on all platforms. | |
| 42 if (functionName == "showModalDialog") { | |
| 43 if (window.showModalDialog != undefined) | |
| 44 shouldBe("typeof window." + functionName, "function", true); | |
| 45 } else | |
| 46 shouldBe("typeof window." + functionName, "function"); | |
| 47 | 41 |
| 48 document.body.removeChild(element); | 42 document.body.removeChild(element); |
| 49 } | 43 } |
| 50 | 44 |
| 51 function runTests() | 45 function runTests() |
| 52 { | 46 { |
| 53 for (var func in windowFunctions) { | 47 for (var func in windowFunctions) { |
| 54 testFunction(windowFunctions[func]) | 48 testFunction(windowFunctions[func]) |
| 55 } | 49 } |
| 56 | 50 |
| 57 window.myFunction = function() { return "myFunction"; } | 51 window.myFunction = function() { return "myFunction"; } |
| 58 testFunction("myFunction"); | 52 testFunction("myFunction"); |
| 59 window.__proto__.myPrototypeFunction = function() { return "myProtot
ypeFunction"; } | 53 window.__proto__.myPrototypeFunction = function() { return "myProtot
ypeFunction"; } |
| 60 testFunction("myPrototypeFunction"); | 54 testFunction("myPrototypeFunction"); |
| 61 } | 55 } |
| 62 </script> | 56 </script> |
| 63 </head> | 57 </head> |
| 64 <body onload="runTests();"> | 58 <body onload="runTests();"> |
| 65 <p>This tests that functions of the window object and it's prototype have pr
ecedence in lookup over elements with id's of the same name.</p> | 59 <p>This tests that functions of the window object and it's prototype have pr
ecedence in lookup over elements with id's of the same name.</p> |
| 66 <pre id="console"></pre> | 60 <pre id="console"></pre> |
| 67 </body> | 61 </body> |
| 68 </html> | 62 </html> |
| OLD | NEW |