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

Unified Diff: content/browser/download/download_request_core.cc

Issue 2561903002: [downloads] Set initiator when handling downloads via a[download] (Closed)
Patch Set: Fix compilation 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
Index: content/browser/download/download_request_core.cc
diff --git a/content/browser/download/download_request_core.cc b/content/browser/download/download_request_core.cc
index f23dcda4bf2270fd276a3f387260bdb0b76bbd3c..cbe34be868f224ac4455acabff8b236e10c0f7e5 100644
--- a/content/browser/download/download_request_core.cc
+++ b/content/browser/download/download_request_core.cc
@@ -181,6 +181,14 @@ std::unique_ptr<net::URLRequest> DownloadRequestCore::CreateRequestOnIOThread(
"If-Range", has_etag ? params->etag() : params->last_modified(), true);
}
+ // Downloads are treated as top level navigations. Hence the first-party
+ // origin for cookies is always based on the target URL and is updated on
+ // redirects.
+ request->set_first_party_for_cookies(params->url());
+ request->set_first_party_url_policy(
+ net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
+ request->set_initiator(params->initiator());
clamy 2016/12/14 16:25:38 Sanity check: Does this happen before or after URL
asanka 2016/12/14 18:21:29 Yup. This happens prior to request->Start() being
+
for (const auto& header : params->request_headers())
request->SetExtraRequestHeaderByName(header.first, header.second,
false /*overwrite*/);

Powered by Google App Engine
This is Rietveld 408576698