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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1679383002: Revert of Don't rely on the pending NavigationEntry for location.replace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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/common/frame_messages.h ('k') | content/test/test_render_frame_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 08a54e3edd5ded089d3226dfb1d1f36af5434162..eb1bcd25d22acb9b29bf5da6560fa52ed856e79a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -3816,11 +3816,10 @@ void RenderFrameImpl::willSendRequest(
// If the navigation is browser-initiated, the NavigationState contains the
// correct value instead of the WebDataSource.
//
- // TODO(creis): Remove should_replace_current_entry from NavigationState
- // once we verify this is a safe change.
- CHECK(!navigation_state->common_params().should_replace_current_entry ||
- data_source->replacesCurrentHistoryItem());
- should_replace_current_entry = data_source->replacesCurrentHistoryItem();
+ // TODO(davidben): Avoid this awkward duplication of state. See comment on
+ // NavigationState::should_replace_current_entry().
+ should_replace_current_entry =
+ navigation_state->common_params().should_replace_current_entry;
}
int provider_id = kInvalidServiceWorkerProviderId;
@@ -4478,7 +4477,6 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
params.intended_as_new_entry =
navigation_state->request_params().intended_as_new_entry;
params.did_create_new_entry = commit_type == blink::WebStandardCommit;
- params.should_replace_current_entry = ds->replacesCurrentHistoryItem();
params.post_id = -1;
params.page_id = render_view_->page_id_;
params.nav_entry_id = navigation_state->request_params().nav_entry_id;
@@ -5293,17 +5291,10 @@ void RenderFrameImpl::OpenURL(const GURL& url,
// This is necessary to preserve the should_replace_current_entry value on
// cross-process redirects, in the event it was set by a previous process.
//
- // TODO(creis): Remove should_replace_current_entry from NavigationState
- // once we verify this is correct, since the WebDataSource should now be
- // correct.
- WebDataSource* ds = frame_->provisionalDataSource();
- CHECK(ds);
- DocumentState* document_state = DocumentState::FromDataSource(ds);
- NavigationStateImpl* navigation_state =
- static_cast<NavigationStateImpl*>(document_state->navigation_state());
- CHECK_EQ(navigation_state->common_params().should_replace_current_entry,
- ds->replacesCurrentHistoryItem());
- params.should_replace_current_entry = ds->replacesCurrentHistoryItem();
+ // TODO(davidben): Avoid this awkward duplication of state. See comment on
+ // NavigationState::should_replace_current_entry().
+ params.should_replace_current_entry =
+ pending_navigation_params_->common_params.should_replace_current_entry;
} else {
params.should_replace_current_entry =
should_replace_current_entry && render_view_->history_list_length_;
@@ -5380,12 +5371,8 @@ void RenderFrameImpl::NavigateInternal(
pending_navigation_params_->common_params.navigation_start =
base::TimeTicks();
- // Create parameters for a standard navigation, indicating whether it should
- // replace the current NavigationEntry.
- blink::WebFrameLoadType load_type =
- common_params.should_replace_current_entry
- ? blink::WebFrameLoadType::ReplaceCurrentItem
- : blink::WebFrameLoadType::Standard;
+ // Create parameters for a standard navigation.
+ blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard;
blink::WebHistoryLoadType history_load_type =
blink::WebHistoryDifferentDocumentLoad;
bool should_load_request = false;
@@ -5512,6 +5499,15 @@ void RenderFrameImpl::NavigateInternal(
SanitizeNavigationTiming(load_type, common_params.navigation_start,
renderer_navigation_start);
+ // PlzNavigate: Check if the load should replace the current item.
+ // TODO(clamy): Remove this when
+ // https://codereview.chromium.org/1250163002/ lands and makes it default
+ // for the current architecture.
+ if (browser_side_navigation && common_params.should_replace_current_entry) {
+ DCHECK(load_type == blink::WebFrameLoadType::Standard);
+ load_type = blink::WebFrameLoadType::ReplaceCurrentItem;
+ }
+
// Perform a navigation to a data url if needed.
if (!common_params.base_url_for_data_url.is_empty() ||
(browser_side_navigation &&
« no previous file with comments | « content/common/frame_messages.h ('k') | content/test/test_render_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698