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

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

Issue 2386983002: PlzNavigate: cancel any navigations if DispatchBeforeUnload is called (other than for starting a ... (Closed)
Patch Set: guard against NavigatorImpl::RequestNavigation resetting the navigation, and add reduced test case Created 4 years, 2 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 | « content/browser/browser_side_navigation_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 56a7f1792c6bbe24465b54ca417b3a8d2edae688..34e252e72fbcf20334bfd04ad92da63984fa8a45 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2332,6 +2332,12 @@ void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation,
bool is_reload) {
DCHECK(for_navigation || !is_reload);
+ if (IsBrowserSideNavigationEnabled() && !for_navigation) {
+ // Cancel any pending navigations, to avoid their navigation commit/fail
+ // event from wiping out the is_waiting_for_beforeunload_ack_ state.
+ frame_tree_node_->ResetNavigationRequest(false);
nasko 2016/10/05 21:25:17 If the beforeunload handler stops the tab from clo
+ }
+
// TODO(creis): Support beforeunload on subframes. For now just pretend that
// the handler ran and allowed the navigation to proceed.
if (!ShouldDispatchBeforeUnload()) {
« no previous file with comments | « content/browser/browser_side_navigation_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698