Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / loader / stateobjects / pushstate-then-replacestate.html
blobd3de76ec5286a05fad726810cc672f7c937243fb
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.pushState("StateStringData", "New title");
19 log("History length is " + history.length);
20 history.replaceState(1, "Replaced 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 == null)
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 pushState()
39 -Makes sure the history length is correct
40 -Makes a call to replaceState()
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 represents the replaced state object
44 </pre><br>
45 <pre id="logger"></pre>
46 </body>
47 </html>