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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1736393002: Remove incorrect sanity checks in RenderFrameHostManager::OnCrossSiteResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (IsBrowserSideNavigationEnabled() && speculative_render_frame_host_) 412 if (IsBrowserSideNavigationEnabled() && speculative_render_frame_host_)
413 CleanUpNavigation(); 413 CleanUpNavigation();
414 414
415 // This is not a cross-process navigation; the tab is being closed. 415 // This is not a cross-process navigation; the tab is being closed.
416 render_frame_host_->render_view_host()->ClosePage(); 416 render_frame_host_->render_view_host()->ClosePage();
417 } 417 }
418 } 418 }
419 } 419 }
420 420
421 void RenderFrameHostManager::OnCrossSiteResponse( 421 void RenderFrameHostManager::OnCrossSiteResponse(
422 RenderFrameHostImpl* pending_render_frame_host, 422 RenderFrameHostImpl* pending_render_frame_host,
Charlie Reis 2016/02/26 23:51:19 Maybe we should rename this while we're at it? So
alexmos 2016/02/27 00:20:28 Good idea, done.
423 const GlobalRequestID& global_request_id, 423 const GlobalRequestID& global_request_id,
424 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, 424 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request,
425 const std::vector<GURL>& transfer_url_chain, 425 const std::vector<GURL>& transfer_url_chain,
426 const Referrer& referrer, 426 const Referrer& referrer,
427 ui::PageTransition page_transition, 427 ui::PageTransition page_transition,
428 bool should_replace_current_entry) { 428 bool should_replace_current_entry) {
429 // We should only get here for transfer navigations. Most cross-process 429 // We should only get here for transfer navigations. Most cross-process
430 // navigations can just continue and wait to run the unload handler (by 430 // navigations can just continue and wait to run the unload handler (by
431 // swapping out) when the new navigation commits. 431 // swapping out) when the new navigation commits.
432 CHECK(cross_site_transferring_request); 432 CHECK(cross_site_transferring_request);
(...skipping 18 matching lines...) Expand all
451 transfer_navigation_handle_ = 451 transfer_navigation_handle_ =
452 pending_render_frame_host->PassNavigationHandleOwnership(); 452 pending_render_frame_host->PassNavigationHandleOwnership();
453 DCHECK(transfer_navigation_handle_); 453 DCHECK(transfer_navigation_handle_);
454 454
455 // Set the transferring RenderFrameHost as not loading, so that it does not 455 // Set the transferring RenderFrameHost as not loading, so that it does not
456 // emit a DidStopLoading notification if it is destroyed when creating the 456 // emit a DidStopLoading notification if it is destroyed when creating the
457 // new navigating RenderFrameHost. 457 // new navigating RenderFrameHost.
458 pending_render_frame_host->set_is_loading(false); 458 pending_render_frame_host->set_is_loading(false);
459 459
460 // Sanity check that the params are for the correct frame and process. 460 // Sanity check that the params are for the correct frame and process.
461 // These should match the RenderFrameHost that made the request. 461 // These should match the RenderFrameHost that made the request. If it
462 // If it started as a cross-process navigation via OpenURL, this is the 462 // started as a cross-process navigation via OpenURL, this is the pending
463 // pending one. If it wasn't cross-process until the transfer, this is 463 // one. If it wasn't cross-process until the transfer, this is the current
464 // the current one. 464 // one.
465 int render_frame_id = pending_render_frame_host_ 465 //
466 ? pending_render_frame_host_->GetRoutingID() 466 // Note that having a pending RenderFrameHost does not imply that it was the
467 : render_frame_host_->GetRoutingID(); 467 // one that made the request. Suppose that during a pending cross-site
468 DCHECK_EQ(render_frame_id, pending_render_frame_host->GetRoutingID()); 468 // navigation, the frame performs a different same-site navigation which
469 int process_id = pending_render_frame_host_ ? 469 // redirects cross-site. In this case, there will be a pending
470 // RenderFrameHost, but this request is made by the current RenderFrameHost.
471 // Later, this will create a new pending RenderFrameHost and clean up the old
472 // one.
473 int request_routing_id = pending_render_frame_host->GetRoutingID();
474 int pending_routing_id = pending_render_frame_host_ ?
475 pending_render_frame_host_->GetRoutingID() :
476 MSG_ROUTING_NONE;
477 DCHECK(request_routing_id == pending_routing_id ||
478 request_routing_id == render_frame_host_->GetRoutingID());
Charlie Reis 2016/02/26 23:51:19 This seems redundant with line 438. (It kind of w
alexmos 2016/02/27 00:20:28 Acknowledged.
479 int process_id = request_routing_id == pending_routing_id ?
Charlie Reis 2016/02/26 23:51:19 Looking closer, I don't think this first part is r
alexmos 2016/02/27 00:20:28 Indeed, you're right. Thanks for catching it! I
470 pending_render_frame_host_->GetProcess()->GetID() : 480 pending_render_frame_host_->GetProcess()->GetID() :
471 render_frame_host_->GetProcess()->GetID(); 481 render_frame_host_->GetProcess()->GetID();
472 DCHECK_EQ(process_id, global_request_id.child_id); 482 DCHECK_EQ(process_id, global_request_id.child_id);
473 483
474 // Treat the last URL in the chain as the destination and the remainder as 484 // Treat the last URL in the chain as the destination and the remainder as
475 // the redirect chain. 485 // the redirect chain.
476 CHECK(transfer_url_chain.size()); 486 CHECK(transfer_url_chain.size());
477 GURL transfer_url = transfer_url_chain.back(); 487 GURL transfer_url = transfer_url_chain.back();
478 std::vector<GURL> rest_of_chain = transfer_url_chain; 488 std::vector<GURL> rest_of_chain = transfer_url_chain;
479 rest_of_chain.pop_back(); 489 rest_of_chain.pop_back();
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2508 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2499 if (!frame_tree_node_->opener()) 2509 if (!frame_tree_node_->opener())
2500 return MSG_ROUTING_NONE; 2510 return MSG_ROUTING_NONE;
2501 2511
2502 return frame_tree_node_->opener() 2512 return frame_tree_node_->opener()
2503 ->render_manager() 2513 ->render_manager()
2504 ->GetRoutingIdForSiteInstance(instance); 2514 ->GetRoutingIdForSiteInstance(instance);
2505 } 2515 }
2506 2516
2507 } // namespace content 2517 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698