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 runTest(); |
14 } else { | 14 if (window.testRunner) |
15 log("To run the test, click the button below when the opened win
dow finishes loading."); | 15 testRunner.notifyDone(); |
16 var button = document.createElement("button"); | 16 }); |
17 button.appendChild(document.createTextNode("Run Test")); | |
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 } | 17 } |
32 | 18 |
33 runTest = function() | 19 runTest = function() |
34 { | 20 { |
35 window.targetWindow = frames[0]; | 21 window.targetWindow = frames[0]; |
36 | 22 |
37 log("----- tests for getting a targetWindow's functions which have c
ustom overrides. The desired " + | 23 log("----- tests for getting a targetWindow's functions which have c
ustom overrides. The desired " + |
38 " behavior is for the targetWindow to return the built-in functi
on, not the override -----\n"); | 24 " behavior is for the targetWindow to return the built-in functi
on, not the override -----\n"); |
39 | 25 |
40 // Overriden using window.focus = function() { return "new focus" } | 26 // Overriden using window.focus = function() { return "new focus" } |
41 shouldBeTrue("canGet('targetWindow.focus')"); | 27 shouldBeTrue("canGet('targetWindow.focus')"); |
42 shouldBe("toString('targetWindow.focus')", "toString('window.focus')
"); | 28 shouldBe("toString('targetWindow.focus')", "toString('window.focus')
"); |
43 | 29 |
44 // Overriden using window.__proto__.blur = function() { return "new
blur;" } | 30 // Overriden using window.__proto__.blur = function() { return "new
blur;" } |
45 shouldBeTrue("canGet('targetWindow.blur')"); | 31 shouldBeTrue("canGet('targetWindow.blur')"); |
46 shouldBe("toString('targetWindow.blur')", "toString('window.blur')")
; | 32 shouldBe("toString('targetWindow.blur')", "toString('window.blur')")
; |
47 | 33 |
48 // Overriden using window.history.close = "new close" | 34 // Overriden using window.history.close = "new close" |
49 shouldBeTrue("canGet('targetWindow.close')"); | 35 shouldBeTrue("canGet('targetWindow.close')"); |
50 shouldBe("toString('targetWindow.close')", "toString('window.close')
"); | 36 shouldBe("toString('targetWindow.close')", "toString('window.close')
"); |
51 } | 37 } |
52 </script> | 38 </script> |
53 </head> | 39 </head> |
54 <body> | 40 <body> |
55 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get
-override-test.html"></iframe> | 41 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get
-override-test.html"></iframe> |
56 <pre id="console"></pre> | 42 <pre id="console"></pre> |
57 </body> | 43 </body> |
58 </html> | 44 </html> |
OLD | NEW |