blob: e2822aa9def0bf6643a95bf860ff0bc74d6dc330 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../js-test-resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Tests that popstate events fire when going back, even when there are resource requests pending.');
window.onload = function(event)
{
debug('Starting slow image request');
var slowImage = document.createElement('img');
slowImage.src = 'resources/slow-image.php';
document.body.appendChild(slowImage);
debug('Pushing newState1');
history.pushState('newState1', null, '?newState1');
setTimeout(function() {
debug('Current search: ' + location.search);
debug('Pushing newState2');
history.pushState('newState2', null, '?newState2');
setTimeout(function() {
debug('Current search: ' + location.search);
debug('Going back');
history.back();
}, 0);
}, 0);
}
window.onpopstate = function(event) {
shouldBe('event.state', '"newState1"');
// Stop the pending image request, otherwise the DRT doesn't consider the
// test over.
window.stop();
finishJSTest();
}
var jsTestIsAsync = true;
</script>
<script src="../../js-test-resources/js-test-post.js"></script>
</body>
</html>