Index: content/browser/frame_host/navigator_impl.cc |
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc |
index 6d63a274159f87f415bc02e76195d8e4c15d49f3..83033ab32dff3ab3b0b776968659cf6926bb6a3d 100644 |
--- a/content/browser/frame_host/navigator_impl.cc |
+++ b/content/browser/frame_host/navigator_impl.cc |
@@ -227,6 +227,22 @@ void NavigatorImpl::DidFailProvisionalLoadWithError( |
controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
} |
+ // If this failure came from a pending RenderFrameHost rather than the |
+ // current one, the current RenderFrameHost needs to be notified to stop |
+ // its load. Typically, the pending RenderFrameHost should be created only |
+ // once the browser process is sure that it will commit, but there is a case |
+ // where this is currently not true, which is when a cross-process frame is |
+ // blocked by X-Frame-Options or CSP frame-ancestors. This check will also |
+ // guard against any future such cases. |
+ // |
+ // TODO(mkwst, alexmos): The case above should disappear when X-Frame-Options |
+ // and CSP enforcement moves to the browser process |
+ // (https://crbug.com/555418). |
+ RenderFrameHostManager* manager = |
+ render_frame_host->frame_tree_node()->render_manager(); |
+ if (render_frame_host == manager->pending_frame_host()) |
+ manager->current_frame_host()->Stop(); |
+ |
if (delegate_) |
delegate_->DidFailProvisionalLoadWithError(render_frame_host, params); |
} |