[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mihaip at chromium.org
mihaip at chromium.org
Wed Dec 22 14:27:11 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d8016516c9e89a7c57ef30d44daa3ac642c85bef
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 9 00:01:57 2010 +0000
2010-10-08 Mihai Parparita <mihaip at chromium.org>
Reviewed by Adam Barth.
popstate events are lost when network connection is in progress
https://bugs.webkit.org/show_bug.cgi?id=42940
Add test case where we have an image request that never finishes while
using pushState and history.back().
* http/tests/history/popstate-fires-with-pending-requests-expected.txt: Added.
* http/tests/history/popstate-fires-with-pending-requests.html: Added.
* http/tests/history/resources/slow-image.php: Added.
2010-10-08 Mihai Parparita <mihaip at chromium.org>
Reviewed by Adam Barth.
popstate events are lost when network connection is in progress
https://bugs.webkit.org/show_bug.cgi?id=42940
Instead of checking FrameLoader::isComplete() (which isn't true if the
document's resource loader has requests outstanding), check that the
document's readyState is complete, as the spec says.
Test: http/tests/history/popstate-fires-with-pending-requests.html
* dom/Document.cpp:
(WebCore::Document::statePopped):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument): Added call to set readyState
to Loading earlier. Otherwise, readyState's initial value is Complete,
and we only set it to Loading in Document::implicitOpen (which is called
after FrameLoader::didBeginDocument by DocumentWriter::begin), so we
could end up in Document::statePopped and have the readyState be
Complete, even if we hadn't even begin loading the document.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 54c2bf4..26bdb9c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-08 Mihai Parparita <mihaip at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ popstate events are lost when network connection is in progress
+ https://bugs.webkit.org/show_bug.cgi?id=42940
+
+ Add test case where we have an image request that never finishes while
+ using pushState and history.back().
+
+ * http/tests/history/popstate-fires-with-pending-requests-expected.txt: Added.
+ * http/tests/history/popstate-fires-with-pending-requests.html: Added.
+ * http/tests/history/resources/slow-image.php: Added.
+
2010-10-08 Abhishek Arya <inferno at chromium.org>
Unreviewed, rolling out r69360.
diff --git a/LayoutTests/http/tests/history/popstate-fires-with-pending-requests-expected.txt b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests-expected.txt
new file mode 100644
index 0000000..63ccbbb
--- /dev/null
+++ b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests-expected.txt
@@ -0,0 +1,16 @@
+Tests that popstate events fire when going back, even when there are resource requests pending.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting slow image request
+Pushing newState1
+Current search: ?newState1
+Pushing newState2
+Current search: ?newState2
+Going back
+PASS event.state is "newState1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html
new file mode 100644
index 0000000..da91876
--- /dev/null
+++ b/LayoutTests/http/tests/history/popstate-fires-with-pending-requests.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+ <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.');
+
+onpopstate = function(event)
+{
+ 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() {
+ debug('Current search: ' + location.search);
+ debug('Going back');
+ history.back();
+ }, 0);
+ }, 0);
+}
+
+
+var successfullyParsed = true;
+var jsTestIsAsync = true;
+</script>
+
+<script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/history/resources/slow-image.php b/LayoutTests/http/tests/history/resources/slow-image.php
new file mode 100644
index 0000000..cf210c4
--- /dev/null
+++ b/LayoutTests/http/tests/history/resources/slow-image.php
@@ -0,0 +1,4 @@
+<?php
+sleep(30);
+header('Location: data:image/gif;base64,R0lGODlhAQABAJAAAMjIyAAAACwAAAAAAQABAAACAgQBADs%3D')
+?>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7c5cebe..4c4f8b8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-10-08 Mihai Parparita <mihaip at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ popstate events are lost when network connection is in progress
+ https://bugs.webkit.org/show_bug.cgi?id=42940
+
+ Instead of checking FrameLoader::isComplete() (which isn't true if the
+ document's resource loader has requests outstanding), check that the
+ document's readyState is complete, as the spec says.
+
+ Test: http/tests/history/popstate-fires-with-pending-requests.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::statePopped):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didBeginDocument): Added call to set readyState
+ to Loading earlier. Otherwise, readyState's initial value is Complete,
+ and we only set it to Loading in Document::implicitOpen (which is called
+ after FrameLoader::didBeginDocument by DocumentWriter::begin), so we
+ could end up in Document::statePopped and have the readyState be
+ Complete, even if we hadn't even begin loading the document.
+
2010-10-08 Daniel Cheng <dcheng at chromium.org>
Reviewed by Tony Chang.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 91be282..f23ea7b 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4428,11 +4428,12 @@ void Document::updateURLForPushOrReplaceState(const KURL& url)
void Document::statePopped(SerializedScriptValue* stateObject)
{
- Frame* f = frame();
- if (!f)
+ if (!frame())
return;
- if (f->loader()->isComplete())
+ // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we
+ // defer firing of popstate until we're in the complete state.
+ if (m_readyState == Complete)
enqueuePopstateEvent(stateObject);
else
m_pendingStateObject = stateObject;
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index e2bd427..2f93102 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -658,6 +658,7 @@ void FrameLoader::didBeginDocument(bool dispatch)
m_isComplete = false;
m_didCallImplicitClose = false;
m_isLoadingMainResource = true;
+ m_frame->document()->setReadyState(Document::Loading);
if (m_pendingStateObject) {
m_frame->document()->statePopped(m_pendingStateObject.get());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list