WebCore:
[WebKit-https.git] / LayoutTests / http / tests / security / resources / cross-frame-iframe-for-history-put-test.html
1 <html>
2 <head>
3     <script src="cross-frame-access.js"></script>
4     <script>
5         var backOld;
6         var forwardOld;
7         var goOld;
8         var toStringOld;
9         var lengthOld;
10
11         receiver = function(e)
12         {
13             if (e.data == "settingValuesComplete")
14                 setCheck();
15         }
16         document.addEventListener('message', receiver, false);
17
18         window.onload = function()
19         {
20             backOld = window.history.back;
21             forwardOld = window.history.forward;
22             goOld = window.history.go;
23             toStringOld = window.history.toString;
24             lengthOld = window.history.length;
25
26             window.parent.postMessage("storedOldValuesComplete");
27         }
28
29         setCheck = function()
30         {
31             log("\n----- tests for putting window.history and its properties -----\n");
32
33             shouldBe("window.history.back", "backOld");
34             shouldBe("window.history.forward", "forwardOld");
35             shouldBe("window.history.go", "goOld");
36             shouldBe("window.history.toString", "toStringOld");
37             shouldBe("window.history.length", "lengthOld", true);
38
39             if (window.layoutTestController)
40                 layoutTestController.notifyDone();
41         }
42     </script>
43 </head>
44 <body>
45     <pre id="console"></pre>
46 </body>
47 </html>