Chromium Code Reviews| Index: content/browser/loader/resource_dispatcher_host_impl.cc |
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
| index 2957728545e30adee24c804af29e71a7cf2d45a8..58246f6a0fe1a6acc946d5b884e63dfc7b6906b7 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -528,6 +528,15 @@ DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload( |
| } |
| request->SetLoadFlags(request->load_flags() | extra_load_flags); |
| + // We treat a download as a main frame load, and thus update the policy URL on |
| + // redirects. |
| + // |
| + // TODO(davidben): Is this correct? If this came from a |
| + // ViewHostMsg_DownloadUrl in a frame, should it have first-party URL set |
| + // appropriately? |
| + request->set_first_party_url_policy( |
| + net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
|
davidben
2014/07/17 22:03:55
This is from download_resource_handler. Given that
mmenke
2014/07/18 15:18:36
They don't get first party URLs? What if we don't
davidben
2014/07/18 16:14:58
Sorry, that was unclear. There's two codepaths for
|
| + |
| // Check if the renderer is permitted to request the requested URL. |
| if (!ChildProcessSecurityPolicyImpl::GetInstance()-> |
| CanRequestURL(child_id, url)) { |
| @@ -1052,6 +1061,13 @@ void ResourceDispatcherHostImpl::BeginRequest( |
| new_request->set_first_party_for_cookies( |
| request_data.first_party_for_cookies); |
| + // If the request is a MAIN_FRAME request, the first-party URL gets updated on |
| + // redirects. |
| + if (request_data.resource_type == ResourceType::MAIN_FRAME) { |
| + new_request->set_first_party_url_policy( |
| + net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
| + } |
| + |
| const Referrer referrer(request_data.referrer, request_data.referrer_policy); |
| SetReferrerForRequest(new_request.get(), referrer); |