Diff
Modified: trunk/LayoutTests/ChangeLog (153648 => 153649)
--- trunk/LayoutTests/ChangeLog 2013-08-02 14:59:27 UTC (rev 153648)
+++ trunk/LayoutTests/ChangeLog 2013-08-02 15:18:19 UTC (rev 153649)
@@ -1,3 +1,17 @@
+2013-08-02 Brady Eidson <beid...@apple.com>
+
+ REGRESSION (r130783): Scrolling is broken going back to a cached page from a page that still has outstanding subresources.
+ <rdar://problem/14601124> and https://bugs.webkit.org/show_bug.cgi?id=119416
+
+ Reviewed by Darin Adler.
+
+ * http/tests/loading/resources/page-with-slow-loading-subresource.html: Added.
+ * http/tests/loading/resources/slowimage.php: Added.
+ * http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt:
+ * http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html:
+ * http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks-expected.txt: Copied from LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt.
+ * http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks.html: Copied from LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html.
+
2013-08-02 Antoine Quint <grao...@apple.com>
<input type="search"> doesn't correctly handle the "size" attribute
Added: trunk/LayoutTests/http/tests/loading/resources/page-with-slow-loading-subresource.html (0 => 153649)
--- trunk/LayoutTests/http/tests/loading/resources/page-with-slow-loading-subresource.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resources/page-with-slow-loading-subresource.html 2013-08-02 15:18:19 UTC (rev 153649)
@@ -0,0 +1,12 @@
+<script>
+
+function documentLoaded() {
+ setTimeout('window.history.back()', 0);
+}
+
+document.addEventListener("DOMContentLoaded", documentLoaded, false);
+
+</script>
+This page has an image that takes forever to load.<br>
+After the main resource is finished loading, but before the image loads, it should go back to the previous page.<br>
+<img src=""
Added: trunk/LayoutTests/http/tests/loading/resources/slowimage.php (0 => 153649)
--- trunk/LayoutTests/http/tests/loading/resources/slowimage.php (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resources/slowimage.php 2013-08-02 15:18:19 UTC (rev 153649)
@@ -0,0 +1,5 @@
+<?php
+sleep(30);
+header('Cache-Control: no-cache, must-revalidate');
+header('Location: data:image/gif;base64,R0lGODlhAQABAJAAAMjIyAAAACwAAAAAAQABAAACAgQBADs%3D');
+?>
Modified: trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt (153648 => 153649)
--- trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt 2013-08-02 14:59:27 UTC (rev 153648)
+++ trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt 2013-08-02 15:18:19 UTC (rev 153649)
@@ -12,7 +12,7 @@
main frame - didFinishLoadForFrame
This test dumps frame load callbacks. It is only useful inside of WebKitTestRunner.
-This link goes to the slow loading page.s Bug 117112 - Going "back" to a cached page from a page with a main resource error breaks scrolling, amongst other issues
+This link goes to a page with a slow loading subresource. Bug 119416 - Going "back" to a cached page from a page with outstanding subresource loads breaks scrolling, amongst other issues.
In the broken case, the second page gets a didFinishLoad callback intertwined with the restoration of the cached page, even though it's already gotten a didFailLoad callback.
The final 4 callbacks look like:
Modified: trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html (153648 => 153649)
--- trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html 2013-08-02 14:59:27 UTC (rev 153648)
+++ trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html 2013-08-02 15:18:19 UTC (rev 153649)
@@ -33,8 +33,8 @@
</script>
This test dumps frame load callbacks. It is only useful inside of WebKitTestRunner.<br><br>
-<a id="linkToSlowPage" href="" link goes to the slow loading page.</a>s
-Bug <a href="" - Going "back" to a cached page from a page with a main resource error breaks scrolling, amongst other issues</a><br><br>
+<a id="linkToSlowPage" href="" link goes to a page with a slow loading subresource.</a>
+Bug <a href="" - Going "back" to a cached page from a page with outstanding subresource loads breaks scrolling, amongst other issues.</a><br><br>
In the broken case, the second page gets a didFinishLoad callback intertwined with the restoration of the cached page, even though it's already gotten a didFailLoad callback.<br>
The final 4 callbacks look like:<br>
didFailLoadWithError<br>
Copied: trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks-expected.txt (from rev 153648, trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks-expected.txt) (0 => 153649)
--- trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks-expected.txt 2013-08-02 15:18:19 UTC (rev 153649)
@@ -0,0 +1,29 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didFailLoadWithError
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishLoadForFrame
+This test dumps frame load callbacks. It is only useful inside of WebKitTestRunner.
+
+This link goes to a slow loading page. Bug 117112 - Going "back" to a cached page from a page where the main resource never finished loading breaks scrolling, amongst other issues.
+
+In the broken case, the second page gets a didFinishLoad callback intertwined with the restoration of the cached page, even though it's already gotten a didFailLoad callback.
+The final 4 callbacks look like:
+didFailLoadWithError
+didStartProvisionalLoadForFrame
+didFinishLoadForFrame
+didCommitLoadForFrame
+
+When fixed, the final 4 callbacks should be:
+didFailLoadWithError
+didStartProvisionalLoadForFrame
+didCommitLoadForFrame
+didFinishLoadForFrame
+
Copied: trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks.html (from rev 153648, trunk/LayoutTests/http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html) (0 => 153649)
--- trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks.html (rev 0)
+++ trunk/LayoutTests/http/tests/loading/unfinished-main-resource-back-to-cached-page-callbacks.html 2013-08-02 15:18:19 UTC (rev 153649)
@@ -0,0 +1,48 @@
+<script>
+
+window._onpageshow_ = function(evt) {
+ if (!window.testRunner)
+ return;
+
+ if (!evt.persisted)
+ return;
+
+ setTimeout("testRunner.notifyDone()", 0);
+}
+
+function clickLinkToSlowPage() {
+ var link = document.getElementById("linkToSlowPage");
+ var linkRect = link.getClientRects()[0];
+ var targetX = linkRect.left + linkRect.width / 2;
+ var targetY = linkRect.top + linkRect.height / 2;
+ eventSender.mouseMoveTo(targetX, targetY);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+window._onload_ = function(evt) {
+ setTimeout("clickLinkToSlowPage()", 0);
+}
+
+if (window.testRunner) {
+ testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+} else
+ document.write('This test must be run by WebKitTestRunner!');
+</script>
+
+This test dumps frame load callbacks. It is only useful inside of WebKitTestRunner.<br><br>
+<a id="linkToSlowPage" href="" link goes to a slow loading page.</a>
+Bug <a href="" - Going "back" to a cached page from a page where the main resource never finished loading breaks scrolling, amongst other issues.</a><br><br>
+In the broken case, the second page gets a didFinishLoad callback intertwined with the restoration of the cached page, even though it's already gotten a didFailLoad callback.<br>
+The final 4 callbacks look like:<br>
+didFailLoadWithError<br>
+didStartProvisionalLoadForFrame<br>
+didFinishLoadForFrame<br>
+didCommitLoadForFrame<br><br>
+When fixed, the final 4 callbacks should be:<br>
+didFailLoadWithError<br>
+didStartProvisionalLoadForFrame<br>
+didCommitLoadForFrame<br>
+didFinishLoadForFrame<br>
Modified: trunk/Source/WebCore/ChangeLog (153648 => 153649)
--- trunk/Source/WebCore/ChangeLog 2013-08-02 14:59:27 UTC (rev 153648)
+++ trunk/Source/WebCore/ChangeLog 2013-08-02 15:18:19 UTC (rev 153649)
@@ -1,3 +1,15 @@
+2013-08-02 Brady Eidson <beid...@apple.com>
+
+ REGRESSION (r130783): Scrolling is broken going back to a cached page from a page that still has outstanding subresources.
+ <rdar://problem/14601124> and https://bugs.webkit.org/show_bug.cgi?id=119416
+
+ Reviewed by Darin Adler.
+
+ Test: http/tests/loading/unfinished-load-back-to-cached-page-callbacks.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::stopLoading): Always explicitly cancel the Document parser when stopLoading is called.
+
2013-08-02 Antoine Quint <grao...@apple.com>
<input type="search"> doesn't correctly handle the "size" attribute
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (153648 => 153649)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2013-08-02 14:59:27 UTC (rev 153648)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2013-08-02 15:18:19 UTC (rev 153649)
@@ -295,12 +295,6 @@
if (isLoadingMainResource()) {
// Stop the main resource loader and let it send the cancelled message.
cancelMainResourceLoad(frameLoader->cancelledError(m_request));
-
- // When cancelling the main resource load, we need to also cancel the Document's parser.
- // Otherwise cancelling the parser when starting the next page load might result
- // in unexpected side effects such as erroneous event dispatch. ( http://webkit.org/b/117112 )
- if (Document* doc = document())
- doc->cancelParsing();
} else if (!m_subresourceLoaders.isEmpty())
// The main resource loader already finished loading. Set the cancelled error on the
// document and let the subresourceLoaders send individual cancelled messages below.
@@ -309,6 +303,12 @@
// If there are no resource loaders, we need to manufacture a cancelled message.
// (A back/forward navigation has no resource loaders because its resources are cached.)
mainReceivedError(frameLoader->cancelledError(m_request));
+
+ // We always need to explicitly cancel the Document's parser when stopping the load.
+ // Otherwise cancelling the parser while starting the next page load might result
+ // in unexpected side effects such as erroneous event dispatch. ( http://webkit.org/b/117112 )
+ if (Document* document = this->document())
+ document->cancelParsing();
stopLoadingSubresources();
stopLoadingPlugIns();