Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / security / cross-frame-access-location-get-override.html
blob943eb9b25e5ceb3cc94526dff64eedcee44b3d4a
1 <html>
2 <head>
3 <script src="resources/cross-frame-access.js"></script>
4 <script>
5 window.onload = function()
7 if (window.testRunner) {
8 testRunner.dumpAsText();
9 testRunner.waitUntilDone();
12 window.addEventListener('message', function ()
14 runTest();
15 if (window.testRunner)
16 testRunner.notifyDone();
17 });
20 runTest = function()
22 window.targetWindow = frames[0];
24 log("----- tests for getting a targetWindow's location object's functions which have custom overrides. The" +
25 " desired behavior is for the targetWindow to return the builtin function, not the override -----\n");
27 // We should test overriding using window.location.__proto__ once the Location object has a proper prototype.
29 // Overriden using window.location.assign = function() { return "new assign" }
30 shouldBeTrue("canGet('targetWindow.location.assign')");
31 shouldBe("toString('targetWindow.location.assign')", "toString('window.location.assign')");
33 // Overriden using window.location.reload = "new reload"
34 shouldBeFalse("canGet('targetWindow.location.reload')");
36 // Overriden using window.location.reload = "new replace"
37 shouldBeTrue("canGet('targetWindow.location.replace')");
38 shouldBe("toString('targetWindow.location.replace')", "toString('window.location.replace')");
40 </script>
41 </head>
42 <body>
43 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-location-get-override-test.html"></iframe>
44 <pre id="console"></pre>
45 </body>
46 </html>