Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Unified Diff: Source/core/loader/DocumentThreadableLoader.cpp

Issue 643733003: DocumentThreadableLoader: Call clearResource() when rejecting redirect (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp
index 3cdd83fde895b57f08203a6de78b8e26fdb8ef44..674d6bbac9ba750ae5a6cc288b4bedb456e810bb 100644
--- a/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/Source/core/loader/DocumentThreadableLoader.cpp
@@ -236,6 +236,12 @@ void DocumentThreadableLoader::setDefersLoading(bool value)
resource()->setDefersLoading(value);
}
+// In this method, we can clear |request| to tell content::WebURLLoaderImpl of
+// Chromium not to follow the redirect. This works only when this method is
+// called by RawResource::willSendRequest(). If called by
+// RawResource::didAddClient(), clearing |request| won't be propagated
+// to content::WebURLLoaderImpl. So, this loader must also get detached from
+// the resource by calling clearResource().
void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
ASSERT(m_client);
@@ -246,13 +252,19 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
// FIXME: Support redirect in Fetch API.
if (resource->resourceRequest().requestContext() == blink::WebURLRequest::RequestContextFetch) {
m_client->didFailRedirectCheck();
+
+ clearResource();
Nate Chapin 2014/10/24 17:09:31 If we call clearResource(), can we get ride of cle
tyoshino (SeeGerritForStatus) 2014/10/27 09:04:08 If the resource has only one client (this loader),
Nate Chapin 2014/10/29 23:37:25 I think it's probably ok to let the request contin
tyoshino (SeeGerritForStatus) 2014/11/05 13:36:09 canReuseRequest() currently check only corsEnabled
request = ResourceRequest();
+
return;
}
if (!isAllowedByPolicy(request.url())) {
m_client->didFailRedirectCheck();
+
+ clearResource();
request = ResourceRequest();
+
m_requestStartedSeconds = 0.0;
return;
}
@@ -319,7 +331,10 @@ void DocumentThreadableLoader::redirectReceived(Resource* resource, ResourceRequ
} else {
m_client->didFailRedirectCheck();
}
+
+ clearResource();
request = ResourceRequest();
+
m_requestStartedSeconds = 0.0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698