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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 264613006: Move first-party cookie URL logic to browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 | « content/child/resource_dispatcher_unittest.cc ('k') | content/common/resource_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index ca8fa82101bb1acec0da57de2ed4fabd7f0fec4c..0dc5266ab07b3b57348fc7207a97824e0a11a0c8 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -239,11 +239,9 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
// RequestPeer methods:
virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE;
- virtual bool OnReceivedRedirect(
- const GURL& new_url,
- const ResourceResponseInfo& info,
- bool* has_new_first_party_for_cookies,
- GURL* new_first_party_for_cookies) OVERRIDE;
+ virtual bool OnReceivedRedirect(const GURL& new_url,
+ const GURL& new_first_party_for_cookies,
+ const ResourceResponseInfo& info) OVERRIDE;
virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE;
virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE;
virtual void OnReceivedData(const char* data,
@@ -474,9 +472,8 @@ void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) {
bool WebURLLoaderImpl::Context::OnReceivedRedirect(
const GURL& new_url,
- const ResourceResponseInfo& info,
- bool* has_new_first_party_for_cookies,
- GURL* new_first_party_for_cookies) {
+ const GURL& new_first_party_for_cookies,
+ const ResourceResponseInfo& info) {
if (!client_)
return false;
@@ -487,7 +484,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect(
// TODO(darin): We lack sufficient information to construct the actual
// request that resulted from the redirect.
WebURLRequest new_request(new_url);
- new_request.setFirstPartyForCookies(request_.firstPartyForCookies());
+ new_request.setFirstPartyForCookies(new_first_party_for_cookies);
new_request.setDownloadToFile(request_.downloadToFile());
WebString referrer_string = WebString::fromUTF8("Referer");
@@ -507,12 +504,16 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect(
client_->willSendRequest(loader_, new_request, response);
request_ = new_request;
- *has_new_first_party_for_cookies = true;
- *new_first_party_for_cookies = request_.firstPartyForCookies();
// Only follow the redirect if WebKit left the URL unmodified.
- if (new_url == GURL(new_request.url()))
+ if (new_url == GURL(new_request.url())) {
+ // First-party cookie logic moved from DocumentLoader in Blink to
+ // CrossSiteResourceHandler in the browser. Assert that Blink didn't try to
+ // change it to something else.
+ DCHECK_EQ(new_first_party_for_cookies.spec(),
+ request_.firstPartyForCookies().string().utf8());
return true;
+ }
// 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.
« no previous file with comments | « content/child/resource_dispatcher_unittest.cc ('k') | content/common/resource_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698