Index: LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html |
diff --git a/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html |
index 0e09038d5c1d96fba6c75d48355424f3581eabf8..441dd8841aec4109903be2e9d8f3b0c37ca197c2 100644 |
--- a/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html |
+++ b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html |
@@ -10,29 +10,20 @@ |
<script> |
description('Tests that popstate events fire when going back, even when there are resource requests pending.'); |
-onpopstate = function(event) |
+window.onload = function() |
{ |
- if (event.state) { |
- shouldBe('event.state', '"newState1"'); |
- // Stop the pending image request, otherwise the DRT doesn't consider the |
- // test over. |
- window.stop(); |
- finishJSTest(); |
- return; |
- } |
- |
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() { |
@@ -43,9 +34,17 @@ onpopstate = function(event) |
}, 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> |
</body> |
</html> |