OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="resources/cross-frame-access.js"></script> | |
4 <script> | |
5 window.onload = function() | |
6 { | |
7 if (window.testRunner) { | |
8 testRunner.dumpAsText(); | |
9 testRunner.waitUntilDone(); | |
10 } | |
11 | |
12 if (window.testRunner) { | |
13 setTimeout(pollForTest, 1); | |
14 } else { | |
15 log("To run the test, click the button below when the opened win
dow finishes loading."); | |
16 var button = document.createElement("button"); | |
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 } | |
32 | |
33 runTest = function() | |
34 { | |
35 window.targetWindow = frames[0]; | |
36 | |
37 log("----- tests for getting a targetWindow's history object's funct
ions which have custom overrides. The" + | |
38 " desired behavior is for the targetWindow to return the builtin
function, not the override -----\n"); | |
39 | |
40 // Overriden using window.history.back = function() { return "new ba
ck" } | |
41 shouldBeTrue("canGet('targetWindow.history.back')"); | |
42 shouldBe("toString('targetWindow.history.back')", "toString('window.
history.back')"); | |
43 | |
44 // Overriden using window.history.__proto__.forward = function() { r
eturn "new forward;" } | |
45 shouldBeTrue("canGet('targetWindow.history.forward')"); | |
46 shouldBe("toString('targetWindow.history.forward')", "toString('wind
ow.history.forward')"); | |
47 | |
48 // Overriden using window.history.go = "new go" | |
49 shouldBeTrue("canGet('targetWindow.history.go')"); | |
50 shouldBe("toString('targetWindow.history.go')", "toString('window.hi
story.go')"); | |
51 } | |
52 </script> | |
53 </head> | |
54 <body> | |
55 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-his
tory-get-override-test.html"></iframe> | |
56 <pre id="console"></pre> | |
57 </body> | |
58 </html> | |
OLD | NEW |