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

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

Issue 2735183003: PlzNavigate: stop navigations when opening a document for write (Closed)
Patch Set: Rebase 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/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index ad1a19a5eb33de3be38b9eb3335cf595e60c6f51..d0727647b7227f634677049a80df68bd990b0c2e 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -1011,7 +1011,8 @@ void NavigatorImpl::OnBeginNavigation(
RenderFrameHost* current_frame_host =
frame_tree_node->render_manager()->current_frame_host();
current_frame_host->Send(
- new FrameMsg_Stop(current_frame_host->GetRoutingID()));
+ new FrameMsg_DroppedNavigation(current_frame_host->GetRoutingID(),
+ begin_params.renderer_navigation_id));
return;
}
@@ -1046,6 +1047,20 @@ void NavigatorImpl::OnBeginNavigation(
navigation_request->BeginNavigation();
}
+void NavigatorImpl::OnAbortNavigation(FrameTreeNode* frame_tree_node) {
+ DCHECK(frame_tree_node);
Charlie Reis 2017/03/20 06:34:44 nit: This seems unnecessary. It doesn't seem like
clamy 2017/03/20 14:56:22 Done.
+
+ NavigationRequest* ongoing_navigation_request =
+ frame_tree_node->navigation_request();
+ if (!ongoing_navigation_request ||
Charlie Reis 2017/03/20 06:34:44 What happens if we've already sent the CommitNavig
clamy 2017/03/20 14:56:22 The ongoing navigation request will no longer exis
Charlie Reis 2017/03/20 23:02:49 Great, that's a bit simpler.
+ ongoing_navigation_request->browser_initiated()) {
Charlie Reis 2017/03/20 06:34:44 The case we're looking at seems really similar to
clamy 2017/03/20 14:56:22 The existing behavior is that document.write will
Charlie Reis 2017/03/20 23:02:49 It only bothered me in the number of different pol
+ return;
+ }
+
+ // Abort the renderer-initiated navigation request.
+ CancelNavigation(frame_tree_node);
+}
+
// PlzNavigate
void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) {
CHECK(IsBrowserSideNavigationEnabled());

Powered by Google App Engine
This is Rietveld 408576698