tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / history / history-back-forward-within-subframe-hash.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <script src="../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <pre id="console"></pre>
9
10 <iframe src="resources/subframe.html" id="iframe1"></iframe>
11
12 <script>
13 description('Ensures that repeated back and forward work for frame hash navigations.');
14
15 var frame = document.getElementById("iframe1").contentWindow;
16 onload = function()
17 {
18     // Make sure that we can generate history entries
19     setTimeout(runTest, 0);
20 }
21
22 // 1. Navigate to hash "#foo".
23 // 2. Go back to hash "".
24 // 3. Go forward to hash "#foo".
25 function runTest()
26 {
27     frame.location.hash = "#foo";
28 }
29
30 frame.onhashchange = function()
31 {
32     if (frame.location.hash == "#foo") {
33         if (!window.localStorage.beenHere) {
34             window.localStorage.beenHere = true;
35             debug("First visit to foo.");
36             history.back();
37         } else {
38             delete window.localStorage.beenHere;
39             debug("Gone forward.");
40             finishJSTest();
41         }
42     }
43     if (frame.location.hash == "") {
44         debug("Gone back.");
45         history.forward();
46     }
47 }
48 var jsTestIsAsync = true;
49 </script>  
50 <script src="../js/resources/js-test-post.js"></script>
51 </body>
52 </html>