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

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

Issue 1907693002: Avoid renderer kills for missing NavigationHandle in DidFail. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 898
899 void RenderFrameHostImpl::OnDidStartProvisionalLoad( 899 void RenderFrameHostImpl::OnDidStartProvisionalLoad(
900 const GURL& url, 900 const GURL& url,
901 const base::TimeTicks& navigation_start) { 901 const base::TimeTicks& navigation_start) {
902 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, 902 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url,
903 navigation_start); 903 navigation_start);
904 } 904 }
905 905
906 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( 906 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
907 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 907 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
908 if (!navigation_handle_) { 908 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and
909 bad_message::ReceivedBadMessage( 909 // return early if navigation_handle_ is null, once we prevent that case from
910 GetProcess(), bad_message::RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE); 910 // happening in practice.
911 return; 911 if (IsBrowserSideNavigationEnabled() && navigation_handle_ &&
912 }
913
914 if (IsBrowserSideNavigationEnabled() &&
915 navigation_handle_->GetNetErrorCode() == net::OK) { 912 navigation_handle_->GetNetErrorCode() == net::OK) {
916 // The renderer should not be sending this message unless asked to commit 913 // The renderer should not be sending this message unless asked to commit
917 // an error page. 914 // an error page.
918 // TODO(clamy): Stop sending DidFailProvisionalLoad IPCs at all when enough 915 // TODO(clamy): Stop sending DidFailProvisionalLoad IPCs at all when enough
919 // observers have moved to DidFinishNavigation. 916 // observers have moved to DidFinishNavigation.
920 bad_message::ReceivedBadMessage( 917 bad_message::ReceivedBadMessage(
921 GetProcess(), bad_message::RFH_FAIL_PROVISIONAL_LOAD_NO_ERROR); 918 GetProcess(), bad_message::RFH_FAIL_PROVISIONAL_LOAD_NO_ERROR);
922 return; 919 return;
923 } 920 }
924 921
925 // Update the error code in the NavigationHandle of the navigation. 922 // Update the error code in the NavigationHandle of the navigation.
926 // PlzNavigate: this has already done in NavigationRequest::OnRequestFailed. 923 // PlzNavigate: this has already done in NavigationRequest::OnRequestFailed.
927 if (!IsBrowserSideNavigationEnabled()) { 924 if (!IsBrowserSideNavigationEnabled() && navigation_handle_) {
928 navigation_handle_->set_net_error_code( 925 navigation_handle_->set_net_error_code(
929 static_cast<net::Error>(params.error_code)); 926 static_cast<net::Error>(params.error_code));
930 } 927 }
931 928
932 frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); 929 frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params);
933 } 930 }
934 931
935 void RenderFrameHostImpl::OnDidFailLoadWithError( 932 void RenderFrameHostImpl::OnDidFailLoadWithError(
936 const GURL& url, 933 const GURL& url,
937 int error_code, 934 int error_code,
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2769 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2773 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2770 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2774 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2771 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2775 } 2772 }
2776 2773
2777 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2774 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2778 web_bluetooth_service_.reset(); 2775 web_bluetooth_service_.reset();
2779 } 2776 }
2780 2777
2781 } // namespace content 2778 } // 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