Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / loader / stateobjects / state-attribute-popstate-event.html
blobeb881055e4a7594102ed793e78c55521b8157628
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.");
10 window.jsTestIsAsync = true;
11 if (window.testRunner) {
12 testRunner.clearBackForwardList();
13 testRunner.waitUntilDone();
16 shouldBeDefined("history.state");
18 debug("Push state 1");
19 history.pushState(1, "", "");
20 debug("Push state 2");
21 history.pushState(2, "", "");
22 shouldEvaluateTo("history.state", 2);
24 var popStateEvent;
25 window.onpopstate = function(e) {
26 popStateEvent = e;
27 shouldEvaluateTo("popStateEvent.state", 1);
28 shouldEvaluateTo("history.state", 1);
30 debug("Push state 3");
31 history.pushState(3, "", "");
32 shouldEvaluateTo("popStateEvent.state", 1);
33 shouldEvaluateTo("history.state", 3);
35 setTimeout(finishJSTest, 0);
38 debug("Go back");
39 window.onload = function() {
40 history.back();
42 </script>
43 </body>
44 </html>