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

Unified Diff: third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc

Issue 2230173002: Change WebURLLoaderClient::willFollowRedirect() API to return bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed jochen's point 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/platform/testing/weburl_loader_mock.cc
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
index 588fd5d1b9ebc617f40c7c95d724698bc12fdc97..9696a59f1f4c70b0e0eba5beb7ab420ff30513e0 100644
--- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
+++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
@@ -82,20 +82,17 @@ WebURLRequest WebURLLoaderMock::ServeRedirect(
WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr();
- client_->willFollowRedirect(this, newRequest, redirectResponse,
- kRedirectResponseOverheadBytes);
+ bool follow = client_->willFollowRedirect(this, newRequest, redirectResponse,
+ kRedirectResponseOverheadBytes);
+ if (!follow)
+ newRequest = WebURLRequest();
jochen (gone - plz use gerrit) 2016/09/30 11:11:24 why this?
tyoshino (SeeGerritForStatus) 2016/10/04 04:02:25 Just preserving the old behavior. Before this chan
// |this| might be deleted in willFollowRedirect().
if (!self)
return newRequest;
- if (redirectURL != KURL(newRequest.url())) {
- // Only follow the redirect if WebKit left the URL unmodified.
- // We assume that WebKit only changes the URL to suppress a redirect, and we
- // assume that it does so by setting it to be invalid.
- DCHECK(!newRequest.url().isValid());
+ if (!follow)
cancel();
- }
return newRequest;
}

Powered by Google App Engine
This is Rietveld 408576698