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

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

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 2 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 blink::WebLocalFrame* frame, 3217 blink::WebLocalFrame* frame,
3218 unsigned identifier, 3218 unsigned identifier,
3219 blink::WebURLRequest& request, 3219 blink::WebURLRequest& request,
3220 const blink::WebURLResponse& redirect_response) { 3220 const blink::WebURLResponse& redirect_response) {
3221 DCHECK(!frame_ || frame_ == frame); 3221 DCHECK(!frame_ || frame_ == frame);
3222 // The request my be empty during tests. 3222 // The request my be empty during tests.
3223 if (request.url().isEmpty()) 3223 if (request.url().isEmpty())
3224 return; 3224 return;
3225 3225
3226 // Set the first party for cookies url if it has not been set yet (new 3226 // Set the first party for cookies url if it has not been set yet (new
3227 // requests). For redirects, it is updated by WebURLLoaderImpl. 3227 // requests). For redirects, it is updated by WebURLLoaderImpl.
estark 2015/10/20 23:41:58 Is this comment true? In WebURLLoaderImpl I only s
Mike West 2015/10/22 13:17:02 It's certainly true that we update the first party
3228 if (request.firstPartyForCookies().isEmpty()) { 3228 if (request.firstPartyForCookies().isEmpty()) {
3229 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) { 3229 if (request.frameType() == blink::WebURLRequest::FrameTypeTopLevel) {
3230 request.setFirstPartyForCookies(request.url()); 3230 request.setFirstPartyForCookies(request.url());
3231 } else { 3231 } else {
3232 // TODO(nasko): When the top-level frame is remote, there is no document. 3232 // TODO(nasko): When the top-level frame is remote, there is no document.
3233 // This is broken and should be fixed to propagate the first party. 3233 // This is broken and should be fixed to propagate the first party.
3234 WebFrame* top = frame->top(); 3234 WebFrame* top = frame->top();
3235 if (top->isWebLocalFrame()) { 3235 if (top->isWebLocalFrame()) {
3236 request.setFirstPartyForCookies( 3236 request.setFirstPartyForCookies(
3237 frame->top()->document().firstPartyForCookies()); 3237 frame->top()->document().firstPartyForCookies());
3238 } 3238 }
3239 } 3239 }
3240
3241 // If the first-party isn't set, we need to set the first-party state as
estark 2015/10/20 23:41:58 This comment isn't parsing for me. Is it possible
Mike West 2015/10/22 13:17:02 Yup. I can't type, obviously. Fixing the comment.
3242 // well; it will not be updated during redirects.
3243 request.setRequestorOrigin(frame->document().securityOrigin());
3240 } 3244 }
3241 3245
3242 WebDataSource* provisional_data_source = frame->provisionalDataSource(); 3246 WebDataSource* provisional_data_source = frame->provisionalDataSource();
3243 WebDataSource* data_source = 3247 WebDataSource* data_source =
3244 provisional_data_source ? provisional_data_source : frame->dataSource(); 3248 provisional_data_source ? provisional_data_source : frame->dataSource();
3245 3249
3246 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3250 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3247 DCHECK(document_state); 3251 DCHECK(document_state);
3248 InternalDocumentStateData* internal_data = 3252 InternalDocumentStateData* internal_data =
3249 InternalDocumentStateData::FromDocumentState(document_state); 3253 InternalDocumentStateData::FromDocumentState(document_state);
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
5194 mojo::ServiceProviderPtr service_provider; 5198 mojo::ServiceProviderPtr service_provider;
5195 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5199 mojo::URLRequestPtr request(mojo::URLRequest::New());
5196 request->url = mojo::String::From(url); 5200 request->url = mojo::String::From(url);
5197 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5201 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5198 nullptr, nullptr, 5202 nullptr, nullptr,
5199 base::Bind(&OnGotContentHandlerID)); 5203 base::Bind(&OnGotContentHandlerID));
5200 return service_provider.Pass(); 5204 return service_provider.Pass();
5201 } 5205 }
5202 5206
5203 } // namespace content 5207 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698