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

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

Issue 2345053006: Remove IsSynchronous API from NavigationHandle. (Closed)
Patch Set: Fix CaptivePortalTabHelperTest.HttpsTimeout 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/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 6cf646955b250812eebeab721dc699202f3fab74..8ad1773c85555fd5a6825ca0caa12f923db0faa8 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1176,10 +1176,10 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
return;
}
- // If the URL does not match what the NavigationHandle expects, treat the
- // commit as a new navigation. This can happen if an ongoing slow
- // same-process navigation is interrupted by a synchronous renderer-initiated
- // navigation.
+ // If the URL or |was_within_same_page| does not match what the
+ // NavigationHandle expects, treat the commit as a new navigation. This can
+ // happen if an ongoing slow same-process navigation is interwoven with a
+ // synchronous renderer-initiated navigation.
// TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get
// reset here, because the NavigationHandle tracks the URL but the
// validated_params.url tracks the data. The trick of saving the old entry ids
@@ -1188,7 +1188,9 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
int entry_id_for_data_nav = 0;
bool is_renderer_initiated = true;
if (navigation_handle_ &&
- (navigation_handle_->GetURL() != validated_params.url)) {
+ ((navigation_handle_->GetURL() != validated_params.url) ||
+ navigation_handle_->IsSamePage() !=
+ validated_params.was_within_same_page)) {
// Make sure that the pending entry was really loaded via
// LoadDataWithBaseURL and that it matches this handle.
NavigationEntryImpl* pending_entry =
@@ -1212,14 +1214,15 @@ void RenderFrameHostImpl::OnDidCommitProvisionalLoad(const IPC::Message& msg) {
// Synchronous renderer-initiated navigations will send a
// DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad
- // message.
+ // message. Or in addition, the if block above can reset the NavigationHandle
+ // in cases it doesn't match the expected commit.
if (!navigation_handle_) {
// There is no pending NavigationEntry in these cases, so pass 0 as the
// nav_id. If the previous handle was a prematurely aborted navigation
// loaded via LoadDataWithBaseURL, propogate the entry id.
navigation_handle_ = NavigationHandleImpl::Create(
validated_params.url, frame_tree_node_, is_renderer_initiated,
- true, // is_synchronous
+ validated_params.was_within_same_page,
validated_params.is_srcdoc, base::TimeTicks::Now(),
entry_id_for_data_nav,
false); // started_from_context_menu

Powered by Google App Engine
This is Rietveld 408576698