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

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

Issue 2381503003: PlzNav: Fix NavigationControllerBrowserTest.EnsureSamePageNavigationUpdatesFrameNaviga… (Closed)
Patch Set: improve test (3) 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
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 8466c51d4c00648f191c0630572ff4778a6fbd2d..905931133337519ae60a2912a87a7844f6b23b45 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -55,8 +55,10 @@ namespace {
FrameMsg_Navigate_Type::Value GetNavigationType(
BrowserContext* browser_context,
+ const FrameTreeNode* frame_tree_node,
const NavigationEntryImpl& entry,
- ReloadType reload_type) {
+ ReloadType reload_type,
+ bool is_same_document_history_load) {
switch (reload_type) {
case ReloadType::NORMAL:
return FrameMsg_Navigate_Type::RELOAD;
@@ -79,6 +81,13 @@ FrameMsg_Navigate_Type::Value GetNavigationType(
return FrameMsg_Navigate_Type::RESTORE;
}
+ // A normal load of the current URL should be treated as a reload.
+ if (frame_tree_node->current_url() == entry.GetURL() &&
clamy 2016/10/12 11:28:32 Sanity check: this is only called for browser-init
+ entry.GetHistoryURLForDataURL().is_empty() && !entry.GetHasPostData() &&
+ !is_same_document_history_load) {
+ return FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE;
Charlie Reis 2016/10/15 00:00:49 I'm curious, does this list of conditions correspo
+ }
+
return FrameMsg_Navigate_Type::NORMAL;
}
@@ -391,8 +400,9 @@ bool NavigatorImpl::NavigateToEntry(
navigation_data_.reset(new NavigationMetricsData(
navigation_start, dest_url, entry.restore_type()));
// Create the navigation parameters.
- FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType(
- controller_->GetBrowserContext(), entry, reload_type);
+ FrameMsg_Navigate_Type::Value navigation_type =
+ GetNavigationType(controller_->GetBrowserContext(), frame_tree_node,
+ entry, reload_type, is_same_document_history_load);
dest_render_frame_host->Navigate(
entry.ConstructCommonNavigationParams(
frame_entry, post_body, dest_url, dest_referrer, navigation_type,
@@ -1097,7 +1107,8 @@ void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node,
bool should_dispatch_beforeunload =
frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload();
FrameMsg_Navigate_Type::Value navigation_type =
- GetNavigationType(controller_->GetBrowserContext(), entry, reload_type);
+ GetNavigationType(controller_->GetBrowserContext(), frame_tree_node,
+ entry, reload_type, is_same_document_history_load);
std::unique_ptr<NavigationRequest> scoped_request =
NavigationRequest::CreateBrowserInitiated(
frame_tree_node, dest_url, dest_referrer, frame_entry, entry,

Powered by Google App Engine
This is Rietveld 408576698