| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="resources/cross-frame-access.js"></script> | 3 <script src="resources/cross-frame-access.js"></script> |
| 4 <script> | 4 <script> |
| 5 window.onload = function() | 5 window.onload = function() |
| 6 { | 6 { |
| 7 if (window.testRunner) { | 7 if (window.testRunner) { |
| 8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
| 9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 if (window.testRunner) { | 12 window.addEventListener('message', function () |
| 13 setTimeout(pollForTest, 1); | 13 { |
| 14 } else { | 14 runTest(); |
| 15 log("To run the test, click the button below when the opened win
dow finishes loading."); | 15 if (window.testRunner) |
| 16 var button = document.createElement("button"); | 16 testRunner.notifyDone(); |
| 17 button.appendChild(document.createTextNode("Run Test")); | 17 }); |
| 18 button.onclick = runTest; | |
| 19 document.body.appendChild(button); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 pollForTest = function() | |
| 24 { | |
| 25 if (!testRunner.globalFlag) { | |
| 26 setTimeout(pollForTest, 1); | |
| 27 return; | |
| 28 } | |
| 29 runTest(); | |
| 30 testRunner.notifyDone(); | |
| 31 } | 18 } |
| 32 | 19 |
| 33 runTest = function() | 20 runTest = function() |
| 34 { | 21 { |
| 35 window.targetWindow = frames[0]; | 22 window.targetWindow = frames[0]; |
| 36 | 23 |
| 37 log("----- tests for getting a targetWindow's location object's func
tions which have custom overrides. The" + | 24 log("----- tests for getting a targetWindow's location object's func
tions which have custom overrides. The" + |
| 38 " desired behavior is for the targetWindow to return the builtin
function, not the override -----\n"); | 25 " desired behavior is for the targetWindow to return the builtin
function, not the override -----\n"); |
| 39 | 26 |
| 40 // We should test overriding using window.location.__proto__ once th
e Location object has a proper prototype. | 27 // We should test overriding using window.location.__proto__ once th
e Location object has a proper prototype. |
| 41 | 28 |
| 42 // Overriden using window.location.assign = function() { return "new
assign" } | 29 // Overriden using window.location.assign = function() { return "new
assign" } |
| 43 shouldBeTrue("canGet('targetWindow.location.assign')"); | 30 shouldBeTrue("canGet('targetWindow.location.assign')"); |
| 44 shouldBe("toString('targetWindow.location.assign')", "toString('wind
ow.location.assign')"); | 31 shouldBe("toString('targetWindow.location.assign')", "toString('wind
ow.location.assign')"); |
| 45 | 32 |
| 46 // Overriden using window.location.reload = "new reload" | 33 // Overriden using window.location.reload = "new reload" |
| 47 shouldBeFalse("canGet('targetWindow.location.reload')"); | 34 shouldBeFalse("canGet('targetWindow.location.reload')"); |
| 48 | 35 |
| 49 // Overriden using window.location.reload = "new replace" | 36 // Overriden using window.location.reload = "new replace" |
| 50 shouldBeTrue("canGet('targetWindow.location.replace')"); | 37 shouldBeTrue("canGet('targetWindow.location.replace')"); |
| 51 shouldBe("toString('targetWindow.location.replace')", "toString('win
dow.location.replace')"); | 38 shouldBe("toString('targetWindow.location.replace')", "toString('win
dow.location.replace')"); |
| 52 } | 39 } |
| 53 </script> | 40 </script> |
| 54 </head> | 41 </head> |
| 55 <body> | 42 <body> |
| 56 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-loc
ation-get-override-test.html"></iframe> | 43 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-loc
ation-get-override-test.html"></iframe> |
| 57 <pre id="console"></pre> | 44 <pre id="console"></pre> |
| 58 </body> | 45 </body> |
| 59 </html> | 46 </html> |
| OLD | NEW |