blob: 2a016798f33fe99c6e92de916ed7e21a5d35e781 [file] [log] [blame]
<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.back();
}
function statePopped()
{
log("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == null)
history.forward();
else if (window.testRunner)
testRunner.notifyDone();
}
window.addEventListener("popstate", statePopped);
</script>
<body onload="runTest();">
<pre>
This test does the following:
-Listens for the popstate event using addEventListener
-Makes a call to pushState()
-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 is correct
</pre><br>
<pre id="logger"></pre>
</body>
</html>