Title: [148198] releases/WebKitGTK/webkit-2.0
Revision
148198
Author
carlo...@webkit.org
Date
2013-04-11 06:36:10 -0700 (Thu, 11 Apr 2013)

Log Message

Merge r148182 - FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
https://bugs.webkit.org/show_bug.cgi?id=112418

Source/WebCore:

Reviewed by Darin Adler.

When the main resource is loaded from the memory cache the
response is not added to the ResponseVector of the document
loader, so that when committing the provisional load the remaining
delegate messages are not called because the ResponseVector of the
document loader is empty. When the main resource is loaded from
the memory cache, there's no resource loader, and the client is
notified about the response received using
ResourceLoadNotifier::dispatchDidReceiveResponse() directly
instead of ResourceLoadNotifier::didReceiveResponse() which is the
one adding the response to the ResponseVector of the document
loader. So, the problem can be fixed by adding the response to the
ResponseVector before calling dispatchDidReceiveResponse() when
loading the main resource without a resource loade

Test: loader/go-back-cached-main-resource.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):

LayoutTests:

Patch by Manuel Rego Casasnovas <r...@igalia.com> on 2013-04-11
Reviewed by Darin Adler.

* loader/go-back-cached-main-resource-expected.txt: Added.
* loader/go-back-cached-main-resource.html: Added.
* loader/resources/first-page.html: Added.
* loader/resources/other-page.html: Added.
* platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt: Added.
* platform/wk2/loader/go-back-cached-main-resource-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.0/LayoutTests/ChangeLog (148197 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/ChangeLog	2013-04-11 13:16:20 UTC (rev 148197)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/ChangeLog	2013-04-11 13:36:10 UTC (rev 148198)
@@ -1,3 +1,17 @@
+2013-04-11  Manuel Rego Casasnovas  <r...@igalia.com>
+
+        FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
+        https://bugs.webkit.org/show_bug.cgi?id=112418
+
+        Reviewed by Darin Adler.
+
+        * loader/go-back-cached-main-resource-expected.txt: Added.
+        * loader/go-back-cached-main-resource.html: Added.
+        * loader/resources/first-page.html: Added.
+        * loader/resources/other-page.html: Added.
+        * platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt: Added.
+        * platform/wk2/loader/go-back-cached-main-resource-expected.txt: Added.
+
 2013-03-14  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [GStreamer] Stopping playback of html5 media when receiving a higher priority audio event needs implementation

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource-expected.txt (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource-expected.txt	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,25 @@
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL resources/first-page.html, http method GET> redirectResponse (null)
+<unknown> - didFinishLoading
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL resources/other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+resources/other-page.html - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL resources/first-page.html, http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL resources/other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+resources/other-page.html - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL (null), http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+This test check the following situation:
+
+First you navigate to a page (first-page.html).
+Then you go to another page (other-page.html).
+You repeat previous steps again (going to first-page.html and then to other-page.html).
+Finally you click back.
+The problem was that the resource load callbacks when going back to the cached main resource were not being called.
+
+See bug #112418.

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource.html (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/loader/go-back-cached-main-resource.html	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,65 @@
+<html>
+<head>
+    <title>Test resource load callbacks going back to a cached main resource</title>
+    <script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.dumpResourceLoadCallbacks();
+        testRunner.setCanOpenWindows();
+        testRunner.waitUntilDone();
+        testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+    }
+
+    // Window we will be controlling.
+    var target;
+
+    // Counter for visits to first page.
+    var firstPageVisits = 0;
+
+    window.addEventListener('message', function(event) {
+
+        if (event.data ="" 'first-page') {
+            firstPageVisits++;
+            if (firstPageVisits < 3)
+                target.postMessage('navigate-other-page', '*');
+            return;
+        }
+
+        if (event.data ="" 'other-page') {
+            switch (firstPageVisits) {
+            case 1:
+                target.postMessage('navigate-first-page', '*');
+                break;
+            case 2:
+                target.postMessage('navigate-back', '*');
+                // Wait a bit for resource load callbacks
+                setTimeout(function () {
+                    target.close();
+                    if (window.testRunner)
+                        window.testRunner.notifyDone();
+                    }, 200);
+                break;
+            }
+            return;
+        }
+
+    }, false);
+
+    function startTest() {
+        // Open the target window and we will start to exchange messages.
+        target = window.open('resources/first-page.html');
+    }
+    </script>
+</head>
+<body _onload_="startTest();">
+    <p>This test check the following situation:</p>
+    <ul>
+        <li>First you navigate to a page (first-page.html).</li>
+        <li>Then you go to another page (other-page.html).</li>
+        <li>You repeat previous steps again (going to first-page.html and then to other-page.html).</li>
+        <li>Finally you click back.</li>
+    </ul>
+    <p>The problem was that the resource load callbacks when going back to the cached main resource were not being called.</p>
+    <p>See <a href="" #112418</a>.</p>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/first-page.html (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/first-page.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/first-page.html	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,23 @@
+<html>
+<head>
+    <script>
+    function registerListeners() {
+        // Notify opener.
+        opener.postMessage('first-page', '*');
+
+        // Our opener will tell us to perform various loads.
+        window.addEventListener('message', function(event) {
+
+            // Navigate to other page.
+            if (event.data ="" 'navigate-other-page') {
+                window.location = 'other-page.html';
+                return;
+            }
+
+        }, false);
+    }
+    </script>
+</head>
+<body _onload_="registerListeners();">
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/other-page.html (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/other-page.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/loader/resources/other-page.html	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,29 @@
+<html>
+<head>
+    <script>
+    function registerListeners() {
+        // Notify opener.
+        opener.postMessage('other-page', '*');
+
+        // Our opener will tell us to perform various loads.
+        window.addEventListener('message', function(event) {
+
+            // Navigate first resource.
+            if (event.data ="" 'navigate-first-page') {
+                window.location = 'first-page.html';
+                return;
+            }
+
+            // Navigate back.
+            if (event.data ="" 'navigate-back') {
+                window.history.back();
+                return;
+            }
+
+        }, false);
+    }
+    </script>
+</head>
+<body _onload_="registerListeners();">
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/platform/gtk-wk1/loader/go-back-cached-main-resource-expected.txt	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,24 @@
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
+<unknown> - didFinishLoading
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+<unknown> - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+<unknown> - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+<unknown> - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+<unknown> - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL , http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+This test check the following situation:
+
+First you navigate to a page (first-page.html).
+Then you go to another page (other-page.html).
+You repeat previous steps again (going to first-page.html and then to other-page.html).
+Finally you click back.
+The problem was that the resource load callbacks when going back to the cached main resource were not being called.
+
+See bug #112418.

Added: releases/WebKitGTK/webkit-2.0/LayoutTests/platform/wk2/loader/go-back-cached-main-resource-expected.txt (0 => 148198)


--- releases/WebKitGTK/webkit-2.0/LayoutTests/platform/wk2/loader/go-back-cached-main-resource-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.0/LayoutTests/platform/wk2/loader/go-back-cached-main-resource-expected.txt	2013-04-11 13:36:10 UTC (rev 148198)
@@ -0,0 +1,25 @@
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
+<unknown> - didFinishLoading
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+resources/other-page.html - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL first-page.html, http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+resources/other-page.html - willSendRequest <NSURLRequest URL resources/other-page.html, main document URL other-page.html, http method GET> redirectResponse (null)
+resources/other-page.html - didReceiveResponse <NSURLResponse resources/other-page.html, http status code 0>
+resources/other-page.html - didFinishLoading
+resources/first-page.html - willSendRequest <NSURLRequest URL resources/first-page.html, main document URL , http method GET> redirectResponse (null)
+resources/first-page.html - didReceiveResponse <NSURLResponse resources/first-page.html, http status code 0>
+resources/first-page.html - didFinishLoading
+This test check the following situation:
+
+First you navigate to a page (first-page.html).
+Then you go to another page (other-page.html).
+You repeat previous steps again (going to first-page.html and then to other-page.html).
+Finally you click back.
+The problem was that the resource load callbacks when going back to the cached main resource were not being called.
+
+See bug #112418.

Modified: releases/WebKitGTK/webkit-2.0/Source/WebCore/ChangeLog (148197 => 148198)


--- releases/WebKitGTK/webkit-2.0/Source/WebCore/ChangeLog	2013-04-11 13:16:20 UTC (rev 148197)
+++ releases/WebKitGTK/webkit-2.0/Source/WebCore/ChangeLog	2013-04-11 13:36:10 UTC (rev 148198)
@@ -1,3 +1,29 @@
+2013-04-11  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        FrameLoaderClient::assignIdentifierToInitialRequest() not called for the main resource when loaded from the memory cache
+        https://bugs.webkit.org/show_bug.cgi?id=112418
+
+        Reviewed by Darin Adler.
+
+        When the main resource is loaded from the memory cache the
+        response is not added to the ResponseVector of the document
+        loader, so that when committing the provisional load the remaining
+        delegate messages are not called because the ResponseVector of the
+        document loader is empty. When the main resource is loaded from
+        the memory cache, there's no resource loader, and the client is
+        notified about the response received using
+        ResourceLoadNotifier::dispatchDidReceiveResponse() directly
+        instead of ResourceLoadNotifier::didReceiveResponse() which is the
+        one adding the response to the ResponseVector of the document
+        loader. So, the problem can be fixed by adding the response to the
+        ResponseVector before calling dispatchDidReceiveResponse() when
+        loading the main resource without a resource loade
+
+        Test: loader/go-back-cached-main-resource.html
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::responseReceived):
+
 2013-04-08  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] DOM objects created wrapping a base class have incorrect GObject type

Modified: releases/WebKitGTK/webkit-2.0/Source/WebCore/loader/MainResourceLoader.cpp (148197 => 148198)


--- releases/WebKitGTK/webkit-2.0/Source/WebCore/loader/MainResourceLoader.cpp	2013-04-11 13:16:20 UTC (rev 148197)
+++ releases/WebKitGTK/webkit-2.0/Source/WebCore/loader/MainResourceLoader.cpp	2013-04-11 13:36:10 UTC (rev 148198)
@@ -438,8 +438,10 @@
 
     m_response = r;
 
-    if (m_identifierForLoadWithoutResourceLoader)
+    if (m_identifierForLoadWithoutResourceLoader) {
+        m_documentLoader->addResponse(m_response);
         frameLoader()->notifier()->dispatchDidReceiveResponse(documentLoader(), identifier(), m_response, 0);
+    }
 
     ASSERT(!m_waitingForContentPolicy);
     m_waitingForContentPolicy = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to