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

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

Issue 2735183003: PlzNavigate: stop navigations when opening a document for write (Closed)
Patch Set: Addressed commemts Created 3 years, 9 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/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 2fdd79c55b1d9dc58ea8b75bce1127ca4e190dbb..ee394a607ab5e7cadf5abfc96f44a58bddddd9d9 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -384,7 +384,7 @@ void FrameTreeNode::CreatedNavigationRequest(
// RenderFrameHostManager will take care of updates to the speculative
// RenderFrameHost in DidCreateNavigationRequest below.
if (was_previously_loading)
- ResetNavigationRequest(true);
+ ResetNavigationRequest(true, true);
navigation_request_ = std::move(navigation_request);
render_manager()->DidCreateNavigationRequest(navigation_request_.get());
@@ -395,7 +395,8 @@ void FrameTreeNode::CreatedNavigationRequest(
DidStartLoading(to_different_document, was_previously_loading);
}
-void FrameTreeNode::ResetNavigationRequest(bool keep_state) {
+void FrameTreeNode::ResetNavigationRequest(bool keep_state,
+ bool inform_renderer) {
CHECK(IsBrowserSideNavigationEnabled());
if (!navigation_request_)
return;
@@ -420,8 +421,11 @@ void FrameTreeNode::ResetNavigationRequest(bool keep_state) {
}
// If the navigation is renderer-initiated, the renderer should also be
- // informed that the navigation stopped.
- if (was_renderer_initiated) {
+ // informed that the navigation stopped if needed. In the case the renderer
+ // process asked for the navigation to be aborted, e.g. following a
+ // document.open, do not send an IPC to the renderer process as it already
+ // expects the navigation to stop.
+ if (was_renderer_initiated && inform_renderer) {
current_frame_host()->Send(
new FrameMsg_Stop(current_frame_host()->GetRoutingID()));
}
@@ -500,7 +504,7 @@ bool FrameTreeNode::StopLoading() {
navigation_request_->navigation_handle()->set_net_error_code(
net::ERR_ABORTED);
}
- ResetNavigationRequest(false);
+ ResetNavigationRequest(false, true);
}
// TODO(nasko): see if child frames should send IPCs in site-per-process
« no previous file with comments | « content/browser/frame_host/frame_tree_node.h ('k') | content/browser/frame_host/navigation_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698