Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: LayoutTests/http/tests/security/cross-frame-access-history-get-override.html

Issue 14198015: Deny cross-origin access to 'window.history'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698