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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1880423002: Ensure in RFH the DidFailProvisionalLoad IPCs correspond to a navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/bad_message.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 1e8b7fd071eed0b418be052b35b8e540fe828101..8c12c6a544b77bf396db3636be5f7d0cbcc3b735 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -897,10 +897,30 @@ void RenderFrameHostImpl::OnDidStartProvisionalLoad(
void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
- if (!IsBrowserSideNavigationEnabled() && navigation_handle_) {
+ if (!navigation_handle_) {
+ bad_message::ReceivedBadMessage(
+ GetProcess(), bad_message::RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE);
+ return;
+ }
+
+ if (IsBrowserSideNavigationEnabled() &&
+ navigation_handle_->GetNetErrorCode() == net::OK) {
+ // The renderer should not be sending this message unless asked to commit
+ // an error page.
+ // TODO(clamy): Stop sending DidFailProvisionalLoad IPCs at all when enough
+ // observers have moved to DidFinishNavigation.
+ bad_message::ReceivedBadMessage(
+ GetProcess(), bad_message::RFH_FAIL_PROVISIONAL_LOAD_NO_ERROR);
+ return;
+ }
+
+ // Update the error code in the NavigationHandle of the navigation.
+ // PlzNavigate: this has already done in NavigationRequest::OnRequestFailed.
+ if (!IsBrowserSideNavigationEnabled()) {
navigation_handle_->set_net_error_code(
static_cast<net::Error>(params.error_code));
}
+
frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params);
}
« no previous file with comments | « content/browser/bad_message.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698