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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2084333002: Correctly set 'firstPartyForCookies' in 'RenderFrameImpl::willSendRequest'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed one. Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 3910 matching lines...) Expand 10 before | Expand all | Expand 10 after
3921 const blink::WebURLResponse& redirect_response) { 3921 const blink::WebURLResponse& redirect_response) {
3922 DCHECK_EQ(frame_, frame); 3922 DCHECK_EQ(frame_, frame);
3923 // The request my be empty during tests. 3923 // The request my be empty during tests.
3924 if (request.url().isEmpty()) 3924 if (request.url().isEmpty())
3925 return; 3925 return;
3926 3926
3927 // Set the first party for cookies url if it has not been set yet (new 3927 // Set the first party for cookies url if it has not been set yet (new
3928 // requests). This value will be updated during redirects, consistent with 3928 // requests). This value will be updated during redirects, consistent with
3929 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1 3929 // https://tools.ietf.org/html/draft-west-first-party-cookies-04#section-2.1.1
3930 if (request.firstPartyForCookies().isEmpty()) { 3930 if (request.firstPartyForCookies().isEmpty()) {
3931 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel) { 3931 if (request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel)
3932 request.setFirstPartyForCookies(request.url()); 3932 request.setFirstPartyForCookies(request.url());
3933 } else { 3933 else
3934 // TODO(nasko): When the top-level frame is remote, there is no document. 3934 request.setFirstPartyForCookies(frame->document().firstPartyForCookies());
3935 // This is broken and should be fixed to propagate the first party.
3936 WebFrame* top = frame->top();
3937 if (top->isWebLocalFrame()) {
3938 request.setFirstPartyForCookies(
3939 frame->top()->document().firstPartyForCookies());
3940 }
3941 }
3942 3935
3943 // If we need to set the first party, then we need to set the request's 3936 // If we need to set the first party, then we need to set the request's
3944 // initiator as well; it will not be updated during redirects. 3937 // initiator as well; it will not be updated during redirects.
3945 request.setRequestorOrigin(frame->document().getSecurityOrigin()); 3938 request.setRequestorOrigin(frame->document().getSecurityOrigin());
3946 } 3939 }
3947 3940
3948 WebDataSource* provisional_data_source = frame->provisionalDataSource(); 3941 WebDataSource* provisional_data_source = frame->provisionalDataSource();
3949 WebDataSource* data_source = 3942 WebDataSource* data_source =
3950 provisional_data_source ? provisional_data_source : frame->dataSource(); 3943 provisional_data_source ? provisional_data_source : frame->dataSource();
3951 3944
(...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
6283 // event target. Potentially a Pepper plugin will receive the event. 6276 // event target. Potentially a Pepper plugin will receive the event.
6284 // In order to tell whether a plugin gets the last mouse event and which it 6277 // In order to tell whether a plugin gets the last mouse event and which it
6285 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6278 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6286 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6279 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6287 // |pepper_last_mouse_event_target_|. 6280 // |pepper_last_mouse_event_target_|.
6288 pepper_last_mouse_event_target_ = nullptr; 6281 pepper_last_mouse_event_target_ = nullptr;
6289 #endif 6282 #endif
6290 } 6283 }
6291 6284
6292 } // namespace content 6285 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_browsertest.cc ('k') | content/test/data/simple_links.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698