[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

darin at chromium.org darin at chromium.org
Wed Apr 7 23:55:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit acc8f48231d0083a66d71310cf0333ca55fdb82e
Author: darin at chromium.org <darin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 24 21:22:54 2009 +0000

    2009-11-24  Darin Fisher  <darin at chromium.org>
    
            Reviewed by Adam Barth.
    
            [Chromium] Renderer hang when using www.expedia.com
            https://bugs.webkit.org/show_bug.cgi?id=31822
    
            Test: http/tests/cache/subresource-failover-to-network.html
    
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::loadResourceSynchronously): Use the originalRequest
            when inheriting cache policy.  This matches SubresourceLoader::create.
    
    2009-11-24  Darin Fisher  <darin at chromium.org>
    
            Reviewed by Adam Barth.
    
            [Chromium] Renderer hang when using www.expedia.com
            https://bugs.webkit.org/show_bug.cgi?id=31822
    
            This test verifies that a synchronous XMLHttpRequest, generated from a
            page that is the result of a form submission, loads properly when the
            user navigates back to the page.
    
            When navigating back to a page that resulted from a form submission,
            the page is loaded with the ReturnCacheDataDontLoad cache policy.  It
            is important that subresources (including XMLHttpRequest instances) do
            not inherit this cache policy.
    
            * http/tests/cache/resources/echo-no-store.cgi: Added.
            * http/tests/cache/resources/subresource-failover-to-network.cgi: Added.
            * http/tests/cache/subresource-failover-to-network-expected.txt: Added.
            * http/tests/cache/subresource-failover-to-network.html: Added.
    
    2009-11-24  Darin Fisher  <darin at chromium.org>
    
            Reviewed by Adam Barth.
    
            [Chromium] Renderer hang when using www.expedia.com
            https://bugs.webkit.org/show_bug.cgi?id=31822
    
            * src/FrameLoaderClientImpl.cpp:
            (WebKit::FrameLoaderClientImpl::dispatchWillSendRequest):
            Assign ReturnCacheDataDontLoad cache policy at the last moment
            to match Safari.  This way the cache policy does not get stored
            in DocumentLoader's originalRequest preventing it from being
            inherited by subresource requests.
            * src/ResourceHandle.cpp:
            (WebCore::ResourceHandle::willLoadFromCache): Remove assignment
            of ReturnCacheDataDontLoad cache policy so that it doesn't end
            up applying to the DocumentLoader's originalRequest.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4b4c266..496d9e5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2009-11-24  Darin Fisher  <darin at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [Chromium] Renderer hang when using www.expedia.com
+        https://bugs.webkit.org/show_bug.cgi?id=31822
+
+        This test verifies that a synchronous XMLHttpRequest, generated from a
+        page that is the result of a form submission, loads properly when the
+        user navigates back to the page.
+
+        When navigating back to a page that resulted from a form submission,
+        the page is loaded with the ReturnCacheDataDontLoad cache policy.  It
+        is important that subresources (including XMLHttpRequest instances) do
+        not inherit this cache policy.
+
+        * http/tests/cache/resources/echo-no-store.cgi: Added.
+        * http/tests/cache/resources/subresource-failover-to-network.cgi: Added.
+        * http/tests/cache/subresource-failover-to-network-expected.txt: Added.
+        * http/tests/cache/subresource-failover-to-network.html: Added.
+
 2009-11-23  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/http/tests/cache/resources/echo-no-store.cgi b/LayoutTests/http/tests/cache/resources/echo-no-store.cgi
new file mode 100755
index 0000000..57577bf
--- /dev/null
+++ b/LayoutTests/http/tests/cache/resources/echo-no-store.cgi
@@ -0,0 +1,7 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/plain\n"; 
+print "Cache-control: no-store\n";
+print "\n";
+read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
+print $data
diff --git a/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi b/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi
new file mode 100755
index 0000000..834f5c4
--- /dev/null
+++ b/LayoutTests/http/tests/cache/resources/subresource-failover-to-network.cgi
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+print "content-type: text/html\n";
+print "\n";
+print <<EOF
+<script>
+try {
+  var r = new XMLHttpRequest();
+  r.open('POST', 'echo-no-store.cgi', false);
+  r.send('PASS');
+  document.write(r.responseText);
+} catch (e) {
+  document.write(e);
+}
+</script>
+EOF
diff --git a/LayoutTests/http/tests/cache/subresource-failover-to-network-expected.txt b/LayoutTests/http/tests/cache/subresource-failover-to-network-expected.txt
new file mode 100644
index 0000000..3aed1f3
--- /dev/null
+++ b/LayoutTests/http/tests/cache/subresource-failover-to-network-expected.txt
@@ -0,0 +1,39 @@
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+<unknown> - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, main document URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http method POST> redirectResponse (null)
+http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http status code 200>
+main frame - didCommitLoadForFrame
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/echo-no-store.cgi, main document URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http method POST> redirectResponse (null)
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/echo-no-store.cgi, http status code 200>
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - didFinishLoading
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/cache/subresource-failover-to-network.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/subresource-failover-to-network.html, main document URL http://127.0.0.1:8000/cache/subresource-failover-to-network.html, http method GET> redirectResponse (null)
+http://127.0.0.1:8000/cache/subresource-failover-to-network.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/subresource-failover-to-network.html, http status code 200>
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+http://127.0.0.1:8000/cache/subresource-failover-to-network.html - didFinishLoading
+main frame - didStartProvisionalLoadForFrame
+http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, main document URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http method POST> redirectResponse (null)
+http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http status code 200>
+main frame - didCommitLoadForFrame
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/echo-no-store.cgi, main document URL http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi, http method POST> redirectResponse (null)
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/echo-no-store.cgi, http status code 200>
+http://127.0.0.1:8000/cache/resources/echo-no-store.cgi - didFinishLoading
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+PASS
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/cache/subresource-failover-to-network.html  **nav target**
+curr->  http://127.0.0.1:8000/cache/resources/subresource-failover-to-network.cgi  **nav target**
+===============================================
diff --git a/LayoutTests/http/tests/cache/subresource-failover-to-network.html b/LayoutTests/http/tests/cache/subresource-failover-to-network.html
new file mode 100644
index 0000000..5aa1050
--- /dev/null
+++ b/LayoutTests/http/tests/cache/subresource-failover-to-network.html
@@ -0,0 +1,31 @@
+<body>
+<script>
+  if ("layoutTestController" in window) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpBackForwardList();
+    layoutTestController.dumpFrameLoadCallbacks();
+    layoutTestController.dumpResourceLoadCallbacks();
+
+    // The results of the form submission is a page that performs a non-
+    // cacheable sync XHR request.  Upon returning to that page, we expect the
+    // sync XHR request to still succeed.  This relies on it loading from the
+    // network and not being restricted to loading from the cache (as the main
+    // page is).
+    layoutTestController.queueLoadingScript("document.forms[0].submit()");
+    layoutTestController.queueBackNavigation(1);
+    layoutTestController.queueForwardNavigation(1);
+  }
+</script>
+<form method="POST" action="resources/subresource-failover-to-network.cgi" enctype="multipart/form-data">
+  <input type="submit">
+</form>
+<p>
+This test verifies that a synchronous XMLHttpRequest, generated from a page
+that is the result of a form submission, loads properly when the user navigates
+back to the page.
+<p>
+When navigating back to a page that resulted from a form submission, the page
+is loaded with the ReturnCacheDataDontLoad cache policy.  It is important that
+subresources (including XMLHttpRequest instances) do not inherit this cache
+policy.
+</body>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d41d4e0..3d2a080 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-11-24  Darin Fisher  <darin at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [Chromium] Renderer hang when using www.expedia.com
+        https://bugs.webkit.org/show_bug.cgi?id=31822
+
+        Test: http/tests/cache/subresource-failover-to-network.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadResourceSynchronously): Use the originalRequest
+        when inheriting cache policy.  This matches SubresourceLoader::create.
+
 2009-11-23  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 3867e8c..3745cd1 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -3259,10 +3259,16 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
     ResourceRequest initialRequest = request;
     initialRequest.setTimeoutInterval(10);
     
+    // Use the original request's cache policy for two reasons:
+    // 1. For POST requests, we mutate the cache policy for the main resource,
+    //    but we do not want this to apply to subresources
+    // 2. Delegates that modify the cache policy using willSendRequest: should
+    //    not affect any other resources. Such changes need to be done
+    //    per request.
     if (initialRequest.isConditional())
         initialRequest.setCachePolicy(ReloadIgnoringCacheData);
     else
-        initialRequest.setCachePolicy(documentLoader()->request().cachePolicy());
+        initialRequest.setCachePolicy(originalRequest().cachePolicy());
     
     if (!referrer.isEmpty())
         initialRequest.setHTTPReferrer(referrer);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index c9e02d4..80dceaf 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-24  Darin Fisher  <darin at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        [Chromium] Renderer hang when using www.expedia.com
+        https://bugs.webkit.org/show_bug.cgi?id=31822
+
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::dispatchWillSendRequest):
+        Assign ReturnCacheDataDontLoad cache policy at the last moment
+        to match Safari.  This way the cache policy does not get stored
+        in DocumentLoader's originalRequest preventing it from being
+        inherited by subresource requests.
+        * src/ResourceHandle.cpp:
+        (WebCore::ResourceHandle::willLoadFromCache): Remove assignment
+        of ReturnCacheDataDontLoad cache policy so that it doesn't end
+        up applying to the DocumentLoader's originalRequest.
+
 2009-11-23  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 4ab6ed8..cbb8eb7 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -260,6 +260,12 @@ void FrameLoaderClientImpl::dispatchWillSendRequest(
         // We want to distinguish between a request for a document to be loaded into
         // the main frame, a sub-frame, or the sub-objects in that document.
         request.setTargetType(determineTargetTypeFromLoader(loader));
+
+        // Avoid repeating a form submission when navigating back or forward.
+        if (loader == loader->frameLoader()->provisionalDocumentLoader()
+            && request.httpMethod() == "POST"
+            && isBackForwardLoadType(loader->frameLoader()->loadType()))
+            request.setCachePolicy(ReturnCacheDataDontLoad);
     }
 
     // FrameLoader::loadEmptyDocumentSynchronously() creates an empty document
diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp
index 6cecd1d..bf6910f 100644
--- a/WebKit/chromium/src/ResourceHandle.cpp
+++ b/WebKit/chromium/src/ResourceHandle.cpp
@@ -271,13 +271,11 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
     // cache.  Even if we checked now, something else could come along and wipe
     // out the cache entry by the time we fetch it.
     //
-    // So, we always say yes here, which allows us to generate an ERR_CACHE_MISS
-    // if the request cannot be serviced from cache.  We force the 'DontLoad'
-    // cache policy at this point to ensure that we never hit the network for
-    // this request.
+    // So, we always say yes here, to prevent the FrameLoader from initiating a
+    // reload.  Then in FrameLoaderClientImpl::dispatchWillSendRequest, we
+    // fix-up the cache policy of the request to force a load from the cache.
     //
     ASSERT(request.httpMethod() == "POST");
-    request.setCachePolicy(ReturnCacheDataDontLoad);
     return true;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list