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

Side by Side Diff: LayoutTests/http/tests/security/cross-frame-access-history-get.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("\n----- tests for getting window.history and its properties --- --\n");
38
39 // history object
40 shouldBeFalse("canGet('targetWindow.history.length')");
41
42 shouldBeTrue("canGet('targetWindow.history.back')");
43 shouldBeTrue("canGet('targetWindow.history.forward')");
44 shouldBeTrue("canGet('targetWindow.history.go')");
45
46 // FIXME: Calling these currently cause the subsequent test to inclu de a dump of this test's render tree.
47 // (see http://bugs.webkit.org/show_bug.cgi?id=16510)
48 // shouldBeTrue("canCall('targetWindow.history.back')");
49 // shouldBeTrue("canCall('targetWindow.history.forward')");
50 // shouldBeTrue("canCall('targetWindow.history.go', '-1')");
51
52 shouldBeTrue("canGet('targetWindow.history.toString')");
53 shouldBe("toString('targetWindow.history')", "'[object History]'");
54
55 shouldBeFalse("canGet('targetWindow.__proto__')");
56 shouldBeFalse("canGet('targetWindow.constructor')");
57
58 // Check custom properties
59 shouldBeFalse("canGet('targetWindow.history.existingCustomProperty') ");
60 shouldBeFalse("canGet('targetWindow.history.__proto__.prototypeCusto mProperty')");
61 shouldBeFalse("canCall('targetWindow.history.existingCustomFunction' )");
62 shouldBeFalse("canCall('targetWindow.history.prototypeCustomFunction ')");
63 }
64 </script>
65 </head>
66 <body>
67 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-his tory-get-test.html"></iframe>
68 <pre id="console"></pre>
69 </body>
70 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698