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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 2373273002: Run unload handlers when navigating to about:blank using PlzNavigate. (Closed)
Patch Set: fix test 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
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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 navigation_request->request_params(), 1048 navigation_request->request_params(),
1049 navigation_request->is_view_source()); 1049 navigation_request->is_view_source());
1050 return; 1050 return;
1051 } 1051 }
1052 1052
1053 frame_tree_node->CreatedNavigationRequest(std::move(scoped_request)); 1053 frame_tree_node->CreatedNavigationRequest(std::move(scoped_request));
1054 navigation_request->CreateNavigationHandle(entry.GetUniqueID()); 1054 navigation_request->CreateNavigationHandle(entry.GetUniqueID());
1055 1055
1056 // Have the current renderer execute its beforeunload event if needed. If it 1056 // Have the current renderer execute its beforeunload event if needed. If it
1057 // is not needed (when beforeunload dispatch is not needed or this navigation 1057 // is not needed (when beforeunload dispatch is not needed or this navigation
1058 // is synchronous and same-site) then NavigationRequest::BeginNavigation 1058 // is synchronous and same-site) then NavigationRequest::BeginNavigation
Charlie Reis 2016/09/30 17:36:10 This comment is a bit confusing to me. What does
jam 2016/09/30 22:42:07 I'm not sure what it was supposed to mean as well,
1059 // should be directly called instead. 1059 // should be directly called instead.
1060 if (should_dispatch_beforeunload && 1060 if (should_dispatch_beforeunload &&
1061 ShouldMakeNetworkRequestForURL( 1061 !navigation_request->common_params().url.SchemeIs(
1062 navigation_request->common_params().url)) { 1062 url::kJavaScriptScheme)) {
Charlie Reis 2016/09/30 17:36:10 I think we need to account for debug URLs like chr
jam 2016/09/30 22:42:07 Good point, yes this behavior is currently broken
jam 2016/09/30 23:11:41 I should also add, it's not clear to me what the r
Charlie Reis 2016/09/30 23:20:08 Yeah, I was just pointing out how it appeared to b
1063 navigation_request->SetWaitingForRendererResponse(); 1063 navigation_request->SetWaitingForRendererResponse();
1064 frame_tree_node->current_frame_host()->DispatchBeforeUnload( 1064 frame_tree_node->current_frame_host()->DispatchBeforeUnload(
1065 true, reload_type != ReloadType::NONE); 1065 true, reload_type != ReloadType::NONE);
1066 } else { 1066 } else {
1067 navigation_request->BeginNavigation(); 1067 navigation_request->BeginNavigation();
1068 } 1068 }
1069 } 1069 }
1070 1070
1071 void NavigatorImpl::RecordNavigationMetrics( 1071 void NavigatorImpl::RecordNavigationMetrics(
1072 const LoadCommittedDetails& details, 1072 const LoadCommittedDetails& details,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 if (pending_entry != controller_->GetVisibleEntry() || 1201 if (pending_entry != controller_->GetVisibleEntry() ||
1202 !should_preserve_entry) { 1202 !should_preserve_entry) {
1203 controller_->DiscardPendingEntry(true); 1203 controller_->DiscardPendingEntry(true);
1204 1204
1205 // Also force the UI to refresh. 1205 // Also force the UI to refresh.
1206 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1206 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1207 } 1207 }
1208 } 1208 }
1209 1209
1210 } // namespace content 1210 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698