- add third_party src.
[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="../../js/resources/js-test-pre.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     history.back();
40 </script>
41 </body>
42 </html>