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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « content/browser/browser_side_navigation_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 } 2325 }
2326 2326
2327 void RenderFrameHostImpl::Stop() { 2327 void RenderFrameHostImpl::Stop() {
2328 Send(new FrameMsg_Stop(routing_id_)); 2328 Send(new FrameMsg_Stop(routing_id_));
2329 } 2329 }
2330 2330
2331 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, 2331 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation,
2332 bool is_reload) { 2332 bool is_reload) {
2333 DCHECK(for_navigation || !is_reload); 2333 DCHECK(for_navigation || !is_reload);
2334 2334
2335 if (IsBrowserSideNavigationEnabled() && !for_navigation) {
2336 // Cancel any pending navigations, to avoid their navigation commit/fail
2337 // event from wiping out the is_waiting_for_beforeunload_ack_ state.
2338 frame_tree_node_->ResetNavigationRequest(false);
nasko 2016/10/05 21:25:17 If the beforeunload handler stops the tab from clo
2339 }
2340
2335 // TODO(creis): Support beforeunload on subframes. For now just pretend that 2341 // TODO(creis): Support beforeunload on subframes. For now just pretend that
2336 // the handler ran and allowed the navigation to proceed. 2342 // the handler ran and allowed the navigation to proceed.
2337 if (!ShouldDispatchBeforeUnload()) { 2343 if (!ShouldDispatchBeforeUnload()) {
2338 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); 2344 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation));
2339 frame_tree_node_->render_manager()->OnBeforeUnloadACK( 2345 frame_tree_node_->render_manager()->OnBeforeUnloadACK(
2340 for_navigation, true, base::TimeTicks::Now()); 2346 for_navigation, true, base::TimeTicks::Now());
2341 return; 2347 return;
2342 } 2348 }
2343 TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload", 2349 TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload",
2344 this, "&RenderFrameHostImpl", (void*)this); 2350 this, "&RenderFrameHostImpl", (void*)this);
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 3092 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
3087 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 3093 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
3088 return web_bluetooth_service_.get(); 3094 return web_bluetooth_service_.get();
3089 } 3095 }
3090 3096
3091 void RenderFrameHostImpl::DeleteWebBluetoothService() { 3097 void RenderFrameHostImpl::DeleteWebBluetoothService() {
3092 web_bluetooth_service_.reset(); 3098 web_bluetooth_service_.reset();
3093 } 3099 }
3094 3100
3095 } // namespace content 3101 } // namespace content
OLDNEW
« 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