5 if (window
.testRunner
) {
6 testRunner
.clearBackForwardList();
7 testRunner
.dumpAsText();
8 testRunner
.waitUntilDone();
13 document
.getElementById("logger").innerText
+= txt
+ "\n";
18 history
.pushState("StateStringData", "New title");
19 log("History length is " + history
.length
);
23 function statePopped()
25 log("State popped - " + event
.state
+ " (type " + typeof event
.state
+ ")");
26 if (event
.state
== null) {
27 document
.body
.onpopstate
= statePopped
;
29 } else if (window
.testRunner
)
30 testRunner
.notifyDone();
34 <body onload=
"runTest();">
36 This test does the following:
37 -Uses body.onpopstate to add a popstate handler (both by using the inline attribute and a script-assigned attribute)
38 -Makes a call to pushState()
39 -Makes sure the history length is correct
40 -Goes back, and makes sure the popstate event is correct
41 -Goes forward, and makes sure the popstate event is correct
43 <pre id=
"logger"></pre>
46 document
.body
.onpopstate
= statePopped
;