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

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, 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
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 98bd475dd028957888be27164f2deb39572c419f..6bbab5b3aabaa00caee632b5a70bc0103ae8cb87 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -157,14 +157,22 @@ void RawResource::didAddClient(ResourceClient* c) {
Resource::didAddClient(client);
}
-void RawResource::willFollowRedirect(ResourceRequest& newRequest,
+bool RawResource::willFollowRedirect(const 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;
+ }
+
+ return follow;
}
void RawResource::willNotFollowRedirect() {
« no previous file with comments | « third_party/WebKit/Source/core/fetch/RawResource.h ('k') | third_party/WebKit/Source/core/fetch/RawResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698