blob: d3de76ec5286a05fad726810cc672f7c937243fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<html>
<head>
<script>
if (window.testRunner) {
testRunner.clearBackForwardList();
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(txt)
{
document.getElementById("logger").innerText += txt + "\n";
}
function runTest()
{
history.pushState("StateStringData", "New title");
log("History length is " + history.length);
history.replaceState(1, "Replaced title");
log("History length is " + history.length);
history.back();
}
onpopstate = function(event)
{
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null)
history.forward();
else if (window.testRunner)
testRunner.notifyDone();
}
</script>
<body onload="runTest();">
<pre>
This test does the following:
-Makes a call to pushState()
-Makes sure the history length is correct
-Makes a call to replaceState()
-Makes sure the history length is correct
-Goes back, and makes sure the popstate event is correct
-Goes forward, and makes sure the popstate event represents the replaced state object
</pre><br>
<pre id="logger"></pre>
</body>
</html>
|