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

Side by Side Diff: content/browser/loader/cross_site_resource_handler.cc

Issue 462083003: Revert of [site isolation] cross-site transfers should track the RenderFrameHost, not the View (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/loader/cross_site_resource_handler.h" 5 #include "content/browser/loader/cross_site_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // cross-site navigations. This is skipped if a transfer is already required 193 // cross-site navigations. This is skipped if a transfer is already required
194 // or for WebUI processes for now, since pages like the NTP host multiple 194 // or for WebUI processes for now, since pages like the NTP host multiple
195 // cross-site WebUI iframes. 195 // cross-site WebUI iframes.
196 if (!should_transfer && 196 if (!should_transfer &&
197 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) && 197 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess) &&
198 !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( 198 !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
199 info->GetChildID())) { 199 info->GetChildID())) {
200 return DeferForNavigationPolicyCheck(info, response, defer); 200 return DeferForNavigationPolicyCheck(info, response, defer);
201 } 201 }
202 202
203 bool swap_needed = 203 bool swap_needed = should_transfer ||
204 should_transfer || 204 CrossSiteRequestManager::GetInstance()->
205 CrossSiteRequestManager::GetInstance()->HasPendingCrossSiteRequest( 205 HasPendingCrossSiteRequest(info->GetChildID(), info->GetRouteID());
206 info->GetChildID(), info->GetRenderFrameID());
207 206
208 // If this is a download, just pass the response through without doing a 207 // If this is a download, just pass the response through without doing a
209 // cross-site check. The renderer will see it is a download and abort the 208 // cross-site check. The renderer will see it is a download and abort the
210 // request. 209 // request.
211 // 210 //
212 // Similarly, HTTP 204 (No Content) responses leave us showing the previous 211 // Similarly, HTTP 204 (No Content) responses leave us showing the previous
213 // page. We should allow the navigation to finish without running the unload 212 // page. We should allow the navigation to finish without running the unload
214 // handler or swapping in the pending RenderFrameHost. 213 // handler or swapping in the pending RenderFrameHost.
215 // 214 //
216 // In both cases, any pending RenderFrameHost (if one was created for this 215 // In both cases, any pending RenderFrameHost (if one was created for this
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 const std::string& security_info, 285 const std::string& security_info,
287 bool* defer) { 286 bool* defer) {
288 if (!in_cross_site_transition_) { 287 if (!in_cross_site_transition_) {
289 ResourceRequestInfoImpl* info = GetRequestInfo(); 288 ResourceRequestInfoImpl* info = GetRequestInfo();
290 // If we've already completed the transition, or we're canceling the 289 // If we've already completed the transition, or we're canceling the
291 // request, or an error occurred with no cross-process navigation in 290 // request, or an error occurred with no cross-process navigation in
292 // progress, then we should just pass this through. 291 // progress, then we should just pass this through.
293 if (has_started_response_ || 292 if (has_started_response_ ||
294 status.status() != net::URLRequestStatus::FAILED || 293 status.status() != net::URLRequestStatus::FAILED ||
295 !CrossSiteRequestManager::GetInstance()->HasPendingCrossSiteRequest( 294 !CrossSiteRequestManager::GetInstance()->HasPendingCrossSiteRequest(
296 info->GetChildID(), info->GetRenderFrameID())) { 295 info->GetChildID(), info->GetRouteID())) {
297 next_handler_->OnResponseCompleted(status, security_info, defer); 296 next_handler_->OnResponseCompleted(status, security_info, defer);
298 return; 297 return;
299 } 298 }
300 299
301 // An error occurred. We should wait now for the cross-process transition, 300 // An error occurred. We should wait now for the cross-process transition,
302 // so that the error message (e.g., 404) can be displayed to the user. 301 // so that the error message (e.g., 404) can be displayed to the user.
303 // Also continue with the logic below to remember that we completed 302 // Also continue with the logic below to remember that we completed
304 // during the cross-site transition. 303 // during the cross-site transition.
305 StartCrossSiteTransition(NULL, false); 304 StartCrossSiteTransition(NULL, false);
306 } 305 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 controller()->Resume(); 441 controller()->Resume();
443 } 442 }
444 } 443 }
445 444
446 void CrossSiteResourceHandler::OnDidDefer() { 445 void CrossSiteResourceHandler::OnDidDefer() {
447 did_defer_ = true; 446 did_defer_ = true;
448 request()->LogBlockedBy("CrossSiteResourceHandler"); 447 request()->LogBlockedBy("CrossSiteResourceHandler");
449 } 448 }
450 449
451 } // namespace content 450 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698