Chromium Code Reviews| Index: content/browser/frame_host/frame_tree_node.cc |
| diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc |
| index 0fadcaa8afb6208aa9e8cc06439e864a03a492eb..a5a3385302f72146d0d9f74446bdf9e6a0dd86ff 100644 |
| --- a/content/browser/frame_host/frame_tree_node.cc |
| +++ b/content/browser/frame_host/frame_tree_node.cc |
| @@ -400,7 +400,7 @@ void FrameTreeNode::CreatedNavigationRequest( |
| // RenderFrameHostManager will take care of updates to the speculative |
| // RenderFrameHost in DidCreateNavigationRequest below. |
| if (was_previously_loading) { |
| - if (navigation_request_) { |
| + if (navigation_request_ && navigation_request_->navigation_handle()) { |
| // Mark the old request as aborted. |
| navigation_request_->navigation_handle()->set_net_error_code( |
| net::ERR_ABORTED); |
| @@ -503,10 +503,15 @@ void FrameTreeNode::DidChangeLoadProgress(double load_progress) { |
| bool FrameTreeNode::StopLoading() { |
| if (IsBrowserSideNavigationEnabled()) { |
| if (navigation_request_) { |
| - navigation_request_->navigation_handle()->set_net_error_code( |
| - net::ERR_ABORTED); |
| - navigator_->DiscardPendingEntryIfNeeded( |
| - navigation_request_->navigation_handle()); |
| + if (navigation_request_->navigation_handle()) { |
| + navigation_request_->navigation_handle()->set_net_error_code( |
| + net::ERR_ABORTED); |
| + } |
| + int expected_pending_nav_entry_id = |
| + navigation_request_->navigation_handle() |
| + ? navigation_request_->navigation_handle()->pending_nav_entry_id() |
| + : navigation_request_->nav_entry_id(); |
|
nasko
2017/05/24 14:20:03
nit: Can't we combine this with the previous if st
clamy
2017/05/24 18:34:38
Done.
|
| + navigator_->DiscardPendingEntryIfNeeded(expected_pending_nav_entry_id); |
| } |
| ResetNavigationRequest(false, true); |
| } |
| @@ -541,6 +546,8 @@ void FrameTreeNode::BeforeUnloadCanceled() { |
| render_manager_.speculative_frame_host(); |
| if (speculative_frame_host) |
| speculative_frame_host->ResetLoadingState(); |
| + if (navigation_request_) |
| + ResetNavigationRequest(false, true); |
|
nasko
2017/05/24 14:20:03
nit: Add a comment why we don't need to set the er
clamy
2017/05/24 18:34:38
Done.
|
| } else { |
| RenderFrameHostImpl* pending_frame_host = |
| render_manager_.pending_frame_host(); |