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

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

Issue 2701093002: PlzNavigate: Cancel ongoing history navigations in the browser when we receive a navigation request… (Closed)
Patch Set: Address review comments 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 997805938531dd69285fc32763d94d83c67f1a6c..57e6fa8dde428664eb3bbd81353a157cac2f230b 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -998,6 +998,17 @@ void NavigatorImpl::OnBeginNavigation(
NavigationRequest* ongoing_navigation_request =
frame_tree_node->navigation_request();
+ // Client redirects during the initial history navigation of a child frame
+ // should take precedence over the history navigation (despite being renderer-
+ // initiated). See https://crbug.com/348447 and https://crbug.com/691168.
+ if (ongoing_navigation_request &&
+ ongoing_navigation_request->request_params()
+ .is_history_navigation_in_new_child) {
+ // Preemptively clear this local pointer before deleting the request.
+ ongoing_navigation_request = nullptr;
+ frame_tree_node->ResetNavigationRequest(false);
+ }
+
// The renderer-initiated navigation request is ignored iff a) there is an
// ongoing request b) which is browser or user-initiated and c) the renderer
// request is not user-initiated.
@@ -1211,7 +1222,11 @@ void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node,
// Have the current renderer execute its beforeunload event if needed. If it
// is not needed then NavigationRequest::BeginNavigation should be directly
// called instead.
- if (should_dispatch_beforeunload && !IsRendererDebugURL(dest_url)) {
+ // We don't want to dispatch a beforeunload handler if
+ // is_history_navigation_in_new_child is true. This indicates a newly created
+ // child frame which does not have a beforunload handler.
+ if (should_dispatch_beforeunload && !IsRendererDebugURL(dest_url) &&
+ !is_history_navigation_in_new_child) {
Charlie Reis 2017/02/18 00:22:52 Oh, sorry! I meant 1 line up from where it was, o
ananta 2017/02/18 00:32:05 Done.
navigation_request->SetWaitingForRendererResponse();
frame_tree_node->current_frame_host()->DispatchBeforeUnload(
true, reload_type != ReloadType::NONE);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698