Commit acc8f482 authored by darin@chromium.org's avatar darin@chromium.org
Browse files

2009-11-24 Darin Fisher <darin@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@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@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
parent fa8b4fca
2009-11-24 Darin Fisher <darin@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@google.com>
 
Reviewed by Oliver Hunt.
#!/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
#!/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
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**
===============================================
<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>
2009-11-24 Darin Fisher <darin@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@google.com>
 
Reviewed by Oliver Hunt.
......@@ -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);
......
2009-11-24 Darin Fisher <darin@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@google.com>
Reviewed by Oliver Hunt.
......
......@@ -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
......
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment