Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_manager.cc |
| diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc |
| index 571bf33c2943f76939b8a24702f24bcb557ebb28..a1fbc91f60990614be10ad751315700e151f5dc5 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager.cc |
| +++ b/content/browser/frame_host/render_frame_host_manager.cc |
| @@ -18,7 +18,6 @@ |
| #include "base/trace_event/trace_event.h" |
| #include "content/browser/child_process_security_policy_impl.h" |
| #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| -#include "content/browser/frame_host/cross_site_transferring_request.h" |
| #include "content/browser/frame_host/debug_urls.h" |
| #include "content/browser/frame_host/frame_navigation_entry.h" |
| #include "content/browser/frame_host/interstitial_page_impl.h" |
| @@ -282,14 +281,10 @@ RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
| // If entry includes the request ID of a request that is being transferred, |
| // the destination render frame will take ownership, so release ownership of |
| - // the request. |
| - if (cross_site_transferring_request_.get() && |
| - cross_site_transferring_request_->request_id() == |
| + // the transferring NavigationHandle. |
| + if (transfer_navigation_handle_.get() && |
| + transfer_navigation_handle_->request_id() == |
| entry.transferred_global_request_id()) { |
| - cross_site_transferring_request_->ReleaseRequest(); |
| - |
| - DCHECK(transfer_navigation_handle_); |
| - |
| // Update the pending NavigationEntry ID on the transferring handle. |
| // TODO(creis): Make this line unnecessary by avoiding having a pending |
| // entry for transfer navigations. See https://crbug.com/495161. |
|
nasko
2016/09/08 23:45:39
Charlie has fixed https://crbug.com/495161 and we
clamy
2016/09/09 15:06:41
Done.
|
| @@ -300,8 +295,10 @@ RenderFrameHostImpl* RenderFrameHostManager::Navigate( |
| // NavigationHandle that came from the transferring RenderFrameHost. |
| dest_render_frame_host->SetNavigationHandle( |
| std::move(transfer_navigation_handle_)); |
| + |
| + dest_render_frame_host->navigation_handle()->TransferredToRenderFrameHost( |
| + dest_render_frame_host); |
| } |
| - DCHECK(!transfer_navigation_handle_); |
| return dest_render_frame_host; |
| } |
| @@ -423,17 +420,10 @@ void RenderFrameHostManager::OnBeforeUnloadACK( |
| void RenderFrameHostManager::OnCrossSiteResponse( |
| RenderFrameHostImpl* transferring_render_frame_host, |
| const GlobalRequestID& global_request_id, |
| - std::unique_ptr<CrossSiteTransferringRequest> |
| - cross_site_transferring_request, |
| const std::vector<GURL>& transfer_url_chain, |
| const Referrer& referrer, |
| ui::PageTransition page_transition, |
| bool should_replace_current_entry) { |
| - // We should only get here for transfer navigations. Most cross-process |
| - // navigations can just continue and wait to run the unload handler (by |
| - // swapping out) when the new navigation commits. |
| - CHECK(cross_site_transferring_request); |
| - |
| // A transfer should only have come from our pending or current RFH. If it |
| // started as a cross-process navigation via OpenURL, this is the pending |
| // one. If it wasn't cross-process until the transfer, this is the current |
| @@ -460,16 +450,7 @@ void RenderFrameHostManager::OnCrossSiteResponse( |
| // after it started navigating. |
| transfer_navigation_handle_ = |
| transferring_render_frame_host->PassNavigationHandleOwnership(); |
| - |
| - // If something caused the cancellation of this navigation on the UI thread |
| - // (possibly for security reasons) the navigation should not be allowed to |
| - // proceed. |
| - if (!transfer_navigation_handle_) |
| - return; |
| - |
| - // Store the transferring request so that we can release it if the transfer |
| - // navigation matches. |
| - cross_site_transferring_request_ = std::move(cross_site_transferring_request); |
| + CHECK(transfer_navigation_handle_); |
| // Set the transferring RenderFrameHost as not loading, so that it does not |
| // emit a DidStopLoading notification if it is destroyed when creating the |
| @@ -492,12 +473,10 @@ void RenderFrameHostManager::OnCrossSiteResponse( |
| transfer_navigation_handle_->IsPost() ? "POST" : "GET", |
| transfer_navigation_handle_->resource_request_body()); |
| - // The transferring request was only needed during the RequestTransferURL |
| - // call, so it is safe to clear at this point. |
| - cross_site_transferring_request_.reset(); |
| - |
| // If the navigation continued, the NavigationHandle should have been |
| // transfered to a RenderFrameHost. In the other cases, it should be cleared. |
| + // If the NavigationHandle wasn't claimed, this will lead to the cancelation |
| + // of the request in the network stack. |
| transfer_navigation_handle_.reset(); |
| // If the navigation in the new renderer did not start, inform the |
| @@ -2300,8 +2279,9 @@ RenderFrameHostImpl* RenderFrameHostManager::UpdateStateForNavigate( |
| if (is_transfer) { |
| // We don't need to stop the old renderer or run beforeunload/unload |
| // handlers, because those have already been done. |
| - DCHECK(cross_site_transferring_request_->request_id() == |
| - transferred_request_id); |
| + DCHECK(transfer_navigation_handle_ && |
| + transfer_navigation_handle_->request_id() == |
| + transferred_request_id); |
| } else if (!pending_render_frame_host_->are_navigations_suspended()) { |
| // If the pending RFH hasn't already been suspended from a previous |
| // attempt to navigate it, then we need to wait for the beforeunload |