Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / cross-frame-access-get-override.html
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             window.addEventListener('message', function () {
13                 runTest();
14                 if (window.testRunner)
15                     testRunner.notifyDone();
16             });
17         }
18
19         runTest = function()
20         {
21             window.targetWindow = frames[0];
22
23             log("----- tests for getting a targetWindow's functions which have custom overrides.  The desired " + 
24                 " behavior is for the targetWindow to return the built-in function, not the override -----\n");
25
26             // Overriden using window.focus = function() { return "new focus" }
27             shouldBeTrue("canGet('targetWindow.focus')");
28             shouldBe("toString('targetWindow.focus')", "toString('window.focus')");
29
30             // Overriden using window.__proto__.blur = function() { return "new blur;" }
31             shouldBeTrue("canGet('targetWindow.blur')");
32             shouldBe("toString('targetWindow.blur')", "toString('window.blur')");
33
34             // Overriden using window.history.close = "new close"
35             shouldBeTrue("canGet('targetWindow.close')");
36             shouldBe("toString('targetWindow.close')", "toString('window.close')");
37         }
38     </script>
39 </head>
40 <body>
41 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get-override-test.html"></iframe>
42 <pre id="console"></pre>
43 </body>
44 </html>