Commit 86c8199e authored by Min Qin's avatar Min Qin Committed by Commit Bot

Network service: update first-party URL for main frame request

This logic is present in ResourceDispatcherHostImpl::ContinuePendingBeginRequest().
However, it is missing in URLLoader when constructing the URLRequest.
The bug causes the wrong cookie to be presented if server redirection happens.
DownloadContentTest.DownloadAttributeSameSiteCookie should provide test coverage for this CL.

BUG=787046

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I708ecba1c386d101ae21e968351732a15fb6f31f
Reviewed-on: https://chromium-review.googlesource.com/779065Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518367}
parent 98387515
...@@ -334,6 +334,13 @@ URLLoader::URLLoader(NetworkContext* context, ...@@ -334,6 +334,13 @@ URLLoader::URLLoader(NetworkContext* context,
url_request_->set_initiator(request.request_initiator); url_request_->set_initiator(request.request_initiator);
// TODO(qinmin): network service shouldn't know about resource type, need
// to introduce another field to set this.
if (request.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
url_request_->set_first_party_url_policy(
net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
}
int load_flags = BuildLoadFlagsForRequest(request, false); int load_flags = BuildLoadFlagsForRequest(request, false);
url_request_->SetLoadFlags(load_flags); url_request_->SetLoadFlags(load_flags);
if (report_raw_headers_) { if (report_raw_headers_) {
......
...@@ -74,6 +74,8 @@ struct CONTENT_EXPORT ResourceRequest { ...@@ -74,6 +74,8 @@ struct CONTENT_EXPORT ResourceRequest {
// What this resource load is for (main frame, sub-frame, sub-resource, // What this resource load is for (main frame, sub-frame, sub-resource,
// object). // object).
// TODO(qinmin): this is used for legacy code path. With network service, it
// shouldn't know about resource type.
ResourceType resource_type = RESOURCE_TYPE_MAIN_FRAME; ResourceType resource_type = RESOURCE_TYPE_MAIN_FRAME;
// The priority of this request determined by Blink. // The priority of this request determined by Blink.
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
-ServiceWorkerVersionBrowserV8CacheTest.Restart -ServiceWorkerVersionBrowserV8CacheTest.Restart
# http://crbug.com/715630 # http://crbug.com/715630
-DownloadContentTest.CookiePolicy
-DownloadContentTest.DownloadAttributeSameSiteCookie
# This started failing when the test got added in r514724. # This started failing when the test got added in r514724.
-DownloadContentTest.ForceDownloadMhtml -DownloadContentTest.ForceDownloadMhtml
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment