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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years 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/test/test_render_frame_host.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index e35938088eaf77926a08624e14578e8666249ec8..67151f6bf099960951a1549a9a66953e458fd43a 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -687,7 +687,9 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
//
// * Include both "strict" and "lax" same-site cookies if the request's
// |url|, |initiator|, and |first_party_for_cookies| all have the same
- // registrable domain.
+ // registrable domain. Note: this also covers the case of a request
+ // without an initiator (only happens for browser-initiated main frame
+ // navigations).
//
// * Include only "lax" same-site cookies if the request's |URL| and
// |first_party_for_cookies| have the same registrable domain, _and_ the
@@ -700,7 +702,7 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
if (registry_controlled_domains::SameDomainOrHost(
request_->url(), request_->first_party_for_cookies(),
registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) {
- if (request_->initiator() &&
+ if (!request_->initiator() ||
registry_controlled_domains::SameDomainOrHost(
request_->url(), request_->initiator().value().GetURL(),
registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)) {
« no previous file with comments | « content/test/test_render_frame_host.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698