Chromium Code Reviews| 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 bbfee654d48b8018a0b5e4a65e6a688db3d8cd93..12ce2d8a72e1722f68616a3d0148f21dc780cacf 100644 |
| --- a/net/url_request/url_request_http_job.cc |
| +++ b/net/url_request/url_request_http_job.cc |
| @@ -659,13 +659,22 @@ void URLRequestHttpJob::DoLoadCookies() { |
| CookieOptions options; |
| options.set_include_httponly(); |
| - // TODO(mkwst): Drop this `if` once we decide whether or not to ship |
| - // first-party cookies: https://crbug.com/459154 |
| - if (network_delegate() && |
| - network_delegate()->AreExperimentalCookieFeaturesEnabled()) |
| - options.set_first_party(url::Origin(request_->first_party_for_cookies())); |
| - else |
| - options.set_include_first_party_only(); |
| + url::Origin origin(request_->url()); |
| + if (origin.IsSameOriginWith( |
| + url::Origin(request_->first_party_for_cookies())) && |
| + (request_->IsMethodSafe() || |
| + origin.IsSameOriginWith(request_->initiator()))) { |
| + options.set_include_first_party_only_cookies(); |
|
mmenke
2015/10/22 19:57:21
What about requests that don't set either of these
Mike West
2016/01/13 08:10:21
If requests aren't being made in a web context, it
|
| + } |
| + |
| + // TODO(mkwst): If first-party-only cookies aren't enabled, pretend the |
| + // request is first-party regardless, in order to include all cookies. Drop |
| + // this check once we decide whether or not we're shipping this feature: |
| + // https://crbug.com/459154 |
| + if (!network_delegate() || |
| + !network_delegate()->AreExperimentalCookieFeaturesEnabled()) { |
| + options.set_include_first_party_only_cookies(); |
| + } |
|
mmenke
2015/10/22 19:57:21
Think this is clearer as:
if (!network_delegate()
Mike West
2016/01/13 08:10:21
My goal was to have something that I could just de
|
| request_->context()->cookie_store()->GetCookiesWithOptionsAsync( |
| request_->url(), options, base::Bind(&URLRequestHttpJob::OnCookiesLoaded, |