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

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

Issue 2697753002: PlzNavigate: Fix dynamic iframe back forward layout test failure (Closed)
Patch Set: Renamed is_user_gesture to has_user_gesture Created 3 years, 10 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/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 997805938531dd69285fc32763d94d83c67f1a6c..e4134e12dfc3dd7cc223ea055c9a0f7f826d1690 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -315,6 +315,7 @@ bool NavigatorImpl::NavigateToEntry(
bool is_same_document_history_load,
bool is_history_navigation_in_new_child,
bool is_pending_entry,
+ bool has_user_gesture,
const scoped_refptr<ResourceRequestBodyImpl>& post_body) {
TRACE_EVENT0("browser,navigation", "NavigatorImpl::NavigateToEntry");
@@ -381,10 +382,11 @@ bool NavigatorImpl::NavigateToEntry(
if (IsBrowserSideNavigationEnabled()) {
navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url,
entry.restore_type()));
- RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry,
- entry, reload_type, previews_state,
- is_same_document_history_load,
- is_history_navigation_in_new_child, navigation_start);
+ RequestNavigation(
+ frame_tree_node, dest_url, dest_referrer, frame_entry, entry,
+ reload_type, previews_state, is_same_document_history_load,
+ is_history_navigation_in_new_child, has_user_gesture,
+ navigation_start);
if (frame_tree_node->IsMainFrame() &&
frame_tree_node->navigation_request()) {
// TODO(carlosk): extend these traces to support subframes and
@@ -502,13 +504,19 @@ bool NavigatorImpl::NavigateToPendingEntry(
const FrameNavigationEntry& frame_entry,
ReloadType reload_type,
bool is_same_document_history_load) {
- return NavigateToEntry(frame_tree_node, frame_entry,
- *controller_->GetPendingEntry(), reload_type,
- is_same_document_history_load, false, true, nullptr);
+ return NavigateToEntry(
+ frame_tree_node, frame_entry, *controller_->GetPendingEntry(),
+ reload_type, is_same_document_history_load,
+ false, // history navigation in new child.
+ true, // pending entry.
+ false, // user gesture.
+ nullptr); // post data.
}
bool NavigatorImpl::NavigateNewChildFrame(
RenderFrameHostImpl* render_frame_host,
+ bool is_renderer_initiated,
+ bool has_user_gesture,
const GURL& default_url) {
NavigationEntryImpl* entry =
controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id());
@@ -520,6 +528,8 @@ bool NavigatorImpl::NavigateNewChildFrame(
if (!frame_entry)
return false;
+ entry->set_is_renderer_initiated(is_renderer_initiated);
+
// Track how often history navigations load a different URL into a subframe
// than the frame's default URL.
bool restoring_different_url = frame_entry->url() != default_url;
@@ -541,7 +551,12 @@ bool NavigatorImpl::NavigateNewChildFrame(
}
return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry,
- *entry, ReloadType::NONE, false, true, false, nullptr);
+ *entry, ReloadType::NONE,
+ false, // same document history load.
+ true, // history navigation in new child.
+ false, // pending entry.
+ has_user_gesture,
+ nullptr); // post data.
}
void NavigatorImpl::DidNavigate(
@@ -957,8 +972,12 @@ void NavigatorImpl::RequestTransferURL(
static_cast<SiteInstanceImpl*>(source_site_instance), dest_url,
referrer_to_use, method, -1);
}
- NavigateToEntry(node, *frame_entry, *entry.get(), ReloadType::NONE, false,
- false, false, post_body);
+ NavigateToEntry(node, *frame_entry, *entry.get(), ReloadType::NONE,
+ false, // same document history load
+ false, // history navigation in new child.
+ false, // pending entry.
+ false, // user gesture.
+ post_body);
}
// PlzNavigate
@@ -974,8 +993,11 @@ void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
if (!navigation_request)
return;
- DCHECK_EQ(NavigationRequest::WAITING_FOR_RENDERER_RESPONSE,
- navigation_request->state());
+ // A new navigation from the browser/renderer may have occurred.
+ if (navigation_request->state() !=
+ NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) {
clamy 2017/02/21 13:46:36 If the result of BeforeUnload is not proceed, shou
+ return;
+ }
// If the navigation is allowed to proceed, send the request to the IO thread.
if (proceed)
@@ -1160,6 +1182,7 @@ void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node,
PreviewsState previews_state,
bool is_same_document_history_load,
bool is_history_navigation_in_new_child,
+ bool has_user_gesture,
base::TimeTicks navigation_start) {
CHECK(IsBrowserSideNavigationEnabled());
DCHECK(frame_tree_node);
@@ -1176,11 +1199,12 @@ void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node,
entry, // entry
frame_entry, // frame_entry
is_same_document_history_load); // is_same_document_history_load
- std::unique_ptr<NavigationRequest> scoped_request =
+ std::unique_ptr<NavigationRequest> scoped_request(
NavigationRequest::CreateBrowserInitiated(
frame_tree_node, dest_url, dest_referrer, frame_entry, entry,
navigation_type, previews_state, is_same_document_history_load,
- is_history_navigation_in_new_child, navigation_start, controller_);
+ is_history_navigation_in_new_child, has_user_gesture,
+ navigation_start, controller_));
// Navigation to a javascript URL is not a "real" navigation so there is no
// need to create a NavigationHandle. The navigation commits immediately and
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698