Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / loader / stateobjects / replacestate-then-pushstate.html
blobfbfa27a6bcc8173d8ffbdbb3c063e8ea4b3e9ebd
1 <html>
2 <head>
3 <script>
5 if (window.testRunner) {
6 testRunner.clearBackForwardList();
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
11 function log(txt)
13 document.getElementById("logger").innerText += txt + "\n";
16 function runTest()
18 history.replaceState("OriginalHistoryItem", "Replaced title");
19 log("History length is " + history.length);
20 history.pushState("NewHistoryItem", "Pushed title");
21 log("History length is " + history.length);
22 history.back();
25 onpopstate = function(event)
27 log("State popped - " + event.state + " (type " + typeof event.state + ")");
28 if (event.state == "OriginalHistoryItem")
29 history.forward();
30 else if (window.testRunner)
31 testRunner.notifyDone();
34 </script>
35 <body onload="runTest();">
36 <pre>
37 This test does the following:
38 -Makes a call to replaceState()
39 -Makes sure the history length is correct
40 -Makes a call to pushState()
41 -Makes sure the history length is correct
42 -Goes back, and makes sure the popstate event is correct
43 -Goes forward, and makes sure the popstate event is correct
44 </pre><br>
45 <pre id="logger"></pre>
46 </body>
47 </html>