5 if (window
.testRunner
) {
6 testRunner
.clearBackForwardList();
7 testRunner
.dumpAsText();
8 testRunner
.waitUntilDone();
13 document
.getElementById("logger").innerText
+= txt
+ "\n";
18 history
.replaceState("OriginalEntry", "original");
19 history
.pushState(null, null, "#");
20 history
.pushState(null, null, "");
21 history
.pushState(null, null, "#hash");
22 history
.pushState(null, null, "#otherhash");
23 history
.pushState(null, null, "#");
24 history
.pushState(null, null, null);
25 history
.pushState(null, null, "some-other.html");
26 history
.pushState(null, null, "some-other.html?withquery");
27 history
.pushState(null, null, "some-other.html?withquery#");
28 history
.pushState(null, null, "some-other.html?withquery");
29 history
.pushState(null, null, "some-other.html?withquery#somehash");
30 history
.pushState(null, null, "some-other.html?withquery#");
31 history
.pushState(null, null, "some-other.html?withquery#someotherhash");
32 history
.pushState(null, null, "some-other.html?withsomeotherquery#someotherhash");
33 history
.pushState(null, null, "some-other.html?withsomeotherquery#somehash");
34 history
.pushState(null, null, "some-other.html?withsomeotherquery");
35 history
.pushState(null, null, "some-other.html?withsomeotherquery#");
36 history
.pushState(null, null, "some-other.html?withsomeotherquery");
38 history
.pushState("BufferEntry", "Last entry");
42 function lastPathComponent(url
)
44 return url
.split('/').pop();
47 onpopstate = function(event
)
49 log("State popped with event " + event
.state
+ " (type " + typeof event
.state
+ ") and last path component " + lastPathComponent(location
.href
));
50 if (event
.state
!= "OriginalEntry")
51 setTimeout("history.back();", 0);
52 else if (window
.testRunner
)
53 testRunner
.notifyDone();
56 onhashchange = function(event
)
58 log("Hash change fired and last path component is " + lastPathComponent(event
.newURL
));
62 <body onload=
"runTest();">
64 This test pushes a series of state objects with different URLs and fragment identifiers meant to test the hashChange event as states are popped.
66 <pre id=
"logger"></pre>