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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2687593002: PlzNavigate: Invoke didFailProvisionalLoad() in the renderer when a navigation request is cancelled… (Closed)
Patch Set: We may not have a provisional data source at all times Created 3 years, 10 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
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 90e3b774554884375faa7e7cbdf99e268c6a2c61..85092d381fb74539150bfc1baed9e7e3382a1b41 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1591,6 +1591,8 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
OnSuppressFurtherDialogs)
IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse)
IPC_MESSAGE_HANDLER(FrameMsg_ClearFocusedElement, OnClearFocusedElement)
+ IPC_MESSAGE_HANDLER(FrameMsg_AbortNavigationRequest,
+ OnAbortNavigationRequest)
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult,
OnActivateNearestFindResult)
@@ -3505,12 +3507,6 @@ void RenderFrameImpl::didFailProvisionalLoad(
TRACE_EVENT1("navigation,benchmark,rail",
"RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_);
DCHECK_EQ(frame_, frame);
- WebDataSource* ds = frame->provisionalDataSource();
- DCHECK(ds);
-
- const WebURLRequest& failed_request = ds->getRequest();
-
- // Notify the browser that we failed a provisional load with an error.
//
// Note: It is important this notification occur before DidStopLoading so the
// SSL manager can react to the provisional load failure before being
@@ -3521,6 +3517,13 @@ void RenderFrameImpl::didFailProvisionalLoad(
for (auto& observer : observers_)
observer.DidFailProvisionalLoad(error);
+ WebDataSource* ds = frame->provisionalDataSource();
+ if (!ds)
+ return;
+
+ const WebURLRequest& failed_request = ds->getRequest();
+
+ // Notify the browser that we failed a provisional load with an error.
SendFailedProvisionalLoad(failed_request, error, frame);
if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL))
@@ -5223,6 +5226,7 @@ void RenderFrameImpl::OnFailedNavigation(
std::unique_ptr<HistoryEntry> history_entry;
if (request_params.page_state.IsValid())
history_entry = PageStateToHistoryEntry(request_params.page_state);
+ didFailProvisionalLoad(frame_, error, blink::WebStandardCommit);
LoadNavigationErrorPage(failed_request, error, replace, history_entry.get());
browser_side_navigation_pending_ = false;
}
@@ -5696,6 +5700,13 @@ void RenderFrameImpl::OnClearFocusedElement() {
webview->clearFocusedElement();
}
+void RenderFrameImpl::OnAbortNavigationRequest(const GURL& url,
+ int error_code) {
+ // Send the provisional load failure.
+ blink::WebURLError error = CreateWebURLError(url, false, error_code);
+ didFailProvisionalLoad(frame_, error, blink::WebStandardCommit);
+}
+
#if defined(OS_ANDROID)
void RenderFrameImpl::OnActivateNearestFindResult(int request_id,
float x,

Powered by Google App Engine
This is Rietveld 408576698