Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / loader / stateobjects / state-attribute-popstate-event.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <script src="../../../resources/js-test.js"></script>
5 </head/>
6 <body>
7 <script>
8     description("Check that PopStateEvent.state always has a correct value.");
9
10     window.jsTestIsAsync = true;
11     if (window.testRunner) {
12         testRunner.clearBackForwardList();
13         testRunner.waitUntilDone();
14     }
15
16     shouldBeDefined("history.state");
17
18     debug("Push state 1");
19     history.pushState(1, "", "");
20     debug("Push state 2");
21     history.pushState(2, "", "");
22     shouldEvaluateTo("history.state", 2);
23
24     var popStateEvent;
25     window.onpopstate = function(e) {
26         popStateEvent = e;
27         shouldEvaluateTo("popStateEvent.state", 1);
28         shouldEvaluateTo("history.state", 1);
29
30         debug("Push state 3");
31         history.pushState(3, "", "");
32         shouldEvaluateTo("popStateEvent.state", 1);
33         shouldEvaluateTo("history.state", 3);
34
35         setTimeout(finishJSTest, 0);
36     }
37
38     debug("Go back");
39     window.onload = function() {
40         history.back();
41     };
42 </script>
43 </body>
44 </html>