blob: a66b52634dbd2eb69ce38d452af84f3684767d30 [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.py';
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>