blob: eb881055e4a7594102ed793e78c55521b8157628 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head/>
<body>
<script>
description("Check that PopStateEvent.state always has a correct value.");
window.jsTestIsAsync = true;
if (window.testRunner) {
testRunner.clearBackForwardList();
testRunner.waitUntilDone();
}
shouldBeDefined("history.state");
debug("Push state 1");
history.pushState(1, "", "");
debug("Push state 2");
history.pushState(2, "", "");
shouldEvaluateTo("history.state", 2);
var popStateEvent;
window.onpopstate = function(e) {
popStateEvent = e;
shouldEvaluateTo("popStateEvent.state", 1);
shouldEvaluateTo("history.state", 1);
debug("Push state 3");
history.pushState(3, "", "");
shouldEvaluateTo("popStateEvent.state", 1);
shouldEvaluateTo("history.state", 3);
setTimeout(finishJSTest, 0);
}
debug("Go back");
window.onload = function() {
history.back();
};
</script>
</body>
</html>