Chromium Code Reviews| 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 032399bd0fbdd103a1fb7d1fb8114284be1d7910..f0789a5736440c777778ed3aaa33561ef102a5a1 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -1174,10 +1174,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 by a |
|
Charlie Reis
2016/09/20 23:35:24
nit: interwoven with
nasko
2016/10/27 17:26:59
Done.
|
| + // 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 |
| @@ -1186,7 +1186,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 = |
| @@ -1210,17 +1212,16 @@ 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.is_srcdoc, base::TimeTicks::Now(), |
| - entry_id_for_data_nav); |
| + validated_params.url, frame_tree_node_, is_renderer_initiated, |
| + validated_params.was_within_same_page, validated_params.is_srcdoc, |
|
Charlie Reis
2016/09/20 23:35:24
I agree with clamy@ that this can technically not
nasko
2016/10/27 17:26:59
Acknowledged.
|
| + base::TimeTicks::Now(), entry_id_for_data_nav); |
| // PlzNavigate |
| if (IsBrowserSideNavigationEnabled()) { |
| // PlzNavigate: synchronous loads happen in the renderer, and the browser |