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 6f1da7b8174a383440ee931e9b8db56cc6a93204..38470e83ec65881324756e04d0baec8b029ff5ca 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -2612,6 +2612,8 @@ void RenderFrameHostImpl::CommitNavigation( |
DCHECK((response && body.get()) || |
common_params.url.SchemeIs(url::kDataScheme) || |
!ShouldMakeNetworkRequestForURL(common_params.url) || |
+ request_params.is_same_document_fragment_change || |
+ request_params.is_same_document_history_load || |
IsRendererDebugURL(common_params.url)); |
UpdatePermissionsForNavigation(common_params, request_params); |
@@ -2634,8 +2636,11 @@ void RenderFrameHostImpl::CommitNavigation( |
request_params)); |
// If a network request was made, update the LoFi state. |
- if (ShouldMakeNetworkRequestForURL(common_params.url)) |
+ if (ShouldMakeNetworkRequestForURL(common_params.url) && |
+ !request_params.is_same_document_fragment_change && |
+ !request_params.is_same_document_history_load) { |
last_navigation_lofi_state_ = common_params.lofi_state; |
+ } |
// TODO(clamy): Release the stream handle once the renderer has finished |
// reading it. |
@@ -3310,14 +3315,25 @@ void RenderFrameHostImpl::OnMediaInterfaceFactoryConnectionError() { |
std::unique_ptr<NavigationHandleImpl> |
RenderFrameHostImpl::TakeNavigationHandleForCommit( |
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
+ bool is_browser_initiated = (params.nav_entry_id != 0); |
+ |
// If this is a same-page navigation, there isn't an existing NavigationHandle |
// to use for the navigation. Create one, but don't reset any NavigationHandle |
// tracking an ongoing navigation, since this may lead to the cancellation of |
// the navigation. |
+ // PlzNavigate: This doesn't apply for browser-initiated same-page navigation, |
+ // because a NavigationHandle is created. |
if (params.was_within_same_page) { |
+ if (IsBrowserSideNavigationEnabled() && is_browser_initiated && |
+ navigation_handle_ && navigation_handle_->IsSamePage() && |
+ navigation_handle_->GetURL() == params.url) { |
+ return std::move(navigation_handle_); |
+ } |
+ |
// We don't ever expect navigation_handle_ to match, because handles are not |
// created for same-page navigations. |
- DCHECK(!navigation_handle_ || !navigation_handle_->IsSamePage()); |
+ DCHECK(IsBrowserSideNavigationEnabled() || !navigation_handle_ || |
+ !navigation_handle_->IsSamePage()); |
// First, determine if the navigation corresponds to the pending navigation |
// entry. This is the case for a browser-initiated same-page navigation, |