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

Unified Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
Index: third_party/WebKit/Source/core/fetch/RawResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp
index 95ce0ae82ad1455c5f841939333afab7ad0bf01a..65d2b3892a07ff22c72860fe63c4c66fa73d684d 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -122,14 +122,24 @@ void RawResource::didAddClient(ResourceClient* c)
Resource::didAddClient(client);
}
-void RawResource::willFollowRedirect(ResourceRequest& newRequest, const ResourceResponse& redirectResponse)
+bool RawResource::willFollowRedirect(ResourceRequest& newRequest, const ResourceResponse& redirectResponse)
{
- Resource::willFollowRedirect(newRequest, redirectResponse);
+ bool follow = Resource::willFollowRedirect(newRequest, redirectResponse);
+ // The base class method takes a non const reference of a ResourceRequest
+ // and returns bool just for allowing RawResource to reject redirect. It
+ // must always return true.
+ DCHECK(follow);
DCHECK(!redirectResponse.isNull());
ResourceClientWalker<RawResourceClient> w(clients());
- while (RawResourceClient* c = w.next())
- c->redirectReceived(this, newRequest, redirectResponse);
+ while (RawResourceClient* c = w.next()) {
+ if (!c->redirectReceived(this, newRequest, redirectResponse)) {
+ follow = false;
+ newRequest = ResourceRequest();
+ }
+ }
+
+ return follow;
}
void RawResource::willNotFollowRedirect()

Powered by Google App Engine
This is Rietveld 408576698