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

Unified Diff: third_party/WebKit/Source/core/loader/PingLoader.cpp

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/core/loader/PingLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp
index 5cae751884d74ec930c09937c27121279573a754..ee4ac98556f694dfff03b19b5d9cf401fc2dbe5b 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -213,7 +213,7 @@ private:
void dispose();
// WebURLLoaderClient
- void willFollowRedirect(WebURLLoader*, WebURLRequest&, const WebURLResponse&, int64_t encodedDataLength) override;
+ bool willFollowRedirect(WebURLLoader*, WebURLRequest&, const WebURLResponse&, int64_t encodedDataLength) override;
void didReceiveResponse(WebURLLoader*, const WebURLResponse&) final;
void didReceiveData(WebURLLoader*, const char*, int, int, int) final;
void didFinishLoading(WebURLLoader*, double, int64_t) final;
@@ -290,16 +290,16 @@ void PingLoaderImpl::dispose()
m_keepAlive.clear();
}
-void PingLoaderImpl::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewRequest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength)
+bool PingLoaderImpl::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewRequest, const WebURLResponse& passedRedirectResponse, int64_t encodedDataLength)
{
if (!m_isBeacon)
- return;
+ return true;
// TODO(tyoshino): Check if setAllowStoredCredentials() should be called
// also for non beacon cases.
passedNewRequest.setAllowStoredCredentials(true);
if (m_corsMode == NotCORSEnabled)
- return;
+ return true;
ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest());
const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceResponse());
@@ -318,12 +318,13 @@ void PingLoaderImpl::willFollowRedirect(WebURLLoader*, WebURLRequest& passedNewR
}
// Cancel the load and self destruct.
dispose();
- // Signal WebURLLoader that the redirect musn't be followed.
- passedNewRequest = WebURLRequest();
- return;
+
+ return false;
}
// FIXME: http://crbug.com/427429 is needed to correctly propagate
// updates of Origin: following this successful redirect.
+
+ return true;
}

Powered by Google App Engine
This is Rietveld 408576698