Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html

Issue 136463002: Don't fire popstate event on initial document load (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix replacestate-in-iframe test Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698