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

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

Issue 2901833002: Create NavigationHandle after beforeunload with PlzNavigate. (Closed)
Patch Set: small fix from jam Created 3 years, 7 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 0fadcaa8afb6208aa9e8cc06439e864a03a492eb..237f3f9a18a91d7480899f2783cded9a370a3756 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -400,7 +400,7 @@ void FrameTreeNode::CreatedNavigationRequest(
// RenderFrameHostManager will take care of updates to the speculative
// RenderFrameHost in DidCreateNavigationRequest below.
if (was_previously_loading) {
- if (navigation_request_) {
+ if (navigation_request_ && navigation_request_->navigation_handle()) {
// Mark the old request as aborted.
navigation_request_->navigation_handle()->set_net_error_code(
net::ERR_ABORTED);
@@ -503,10 +503,14 @@ void FrameTreeNode::DidChangeLoadProgress(double load_progress) {
bool FrameTreeNode::StopLoading() {
if (IsBrowserSideNavigationEnabled()) {
if (navigation_request_) {
- navigation_request_->navigation_handle()->set_net_error_code(
- net::ERR_ABORTED);
- navigator_->DiscardPendingEntryIfNeeded(
- navigation_request_->navigation_handle());
+ int expected_pending_nav_entry_id = navigation_request_->nav_entry_id();
+ if (navigation_request_->navigation_handle()) {
+ navigation_request_->navigation_handle()->set_net_error_code(
+ net::ERR_ABORTED);
+ expected_pending_nav_entry_id =
+ navigation_request_->navigation_handle()->pending_nav_entry_id();
+ }
+ navigator_->DiscardPendingEntryIfNeeded(expected_pending_nav_entry_id);
}
ResetNavigationRequest(false, true);
}
@@ -541,6 +545,11 @@ void FrameTreeNode::BeforeUnloadCanceled() {
render_manager_.speculative_frame_host();
if (speculative_frame_host)
speculative_frame_host->ResetLoadingState();
+ // Note: there is no need to set an error code on the NavigationHandle here
+ // as it has not been created yet. It is only created when the
+ // BeforeUnloadACK is received.
+ if (navigation_request_)
+ ResetNavigationRequest(false, true);
} else {
RenderFrameHostImpl* pending_frame_host =
render_manager_.pending_frame_host();

Powered by Google App Engine
This is Rietveld 408576698