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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 4 years, 11 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 | « net/url_request/url_fetcher_core.h ('k') | net/url_request/url_fetcher_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 5fe0dbdc52cb595b877b8c03d9cf3272821e5f62..ee1a3d8c83010938d4c6d10cedc3e69fd348384b 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -245,10 +245,9 @@ void URLFetcherCore::SetRequestContext(
request_context_getter_ = request_context_getter;
}
-void URLFetcherCore::SetFirstPartyForCookies(
- const GURL& first_party_for_cookies) {
- DCHECK(first_party_for_cookies_.is_empty());
- first_party_for_cookies_ = first_party_for_cookies;
+void URLFetcherCore::SetInitiatorURL(const GURL& initiator) {
+ DCHECK(initiator_.is_empty());
+ initiator_ = initiator;
}
void URLFetcherCore::SetURLRequestUserData(
@@ -556,8 +555,10 @@ void URLFetcherCore::StartURLRequest() {
request_->SetLoadFlags(flags);
request_->SetReferrer(referrer_);
request_->set_referrer_policy(referrer_policy_);
- request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ?
- original_url_ : first_party_for_cookies_);
+ request_->set_first_party_for_cookies(initiator_.is_empty() ? original_url_
+ : initiator_);
mmenke 2016/01/14 16:47:42 Hrm...wasn't even aware of this code. :(
+ request_->set_initiator(initiator_.is_empty() ? url::Origin(original_url_)
+ : url::Origin(initiator_));
if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) {
request_->SetUserData(url_request_data_key_,
url_request_create_data_callback_.Run());
@@ -696,7 +697,7 @@ void URLFetcherCore::CancelURLRequest(int error) {
// delete the object, but we cannot delay the destruction of the request
// context.
request_context_getter_ = NULL;
- first_party_for_cookies_ = GURL();
+ initiator_ = GURL();
url_request_data_key_ = NULL;
url_request_create_data_callback_.Reset();
was_cancelled_ = true;
@@ -787,7 +788,7 @@ void URLFetcherCore::RetryOrCompleteUrlFetch() {
}
request_context_getter_ = NULL;
- first_party_for_cookies_ = GURL();
+ initiator_ = GURL();
url_request_data_key_ = NULL;
url_request_create_data_callback_.Reset();
bool posted = delegate_task_runner_->PostTask(
« no previous file with comments | « net/url_request/url_fetcher_core.h ('k') | net/url_request/url_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698