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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1976573002: Only use pending navigation params for browser-initiated navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: backward comment Created 4 years, 7 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/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 75bb31eb4732ef4c141537b0b8d236f3bd05a214..c1d6013a7ef146a8ba16551c16280fd66679898f 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -3566,22 +3566,26 @@ void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) {
ds->request().url()));
}
-void RenderFrameImpl::didNavigateWithinPage(blink::WebLocalFrame* frame,
+void RenderFrameImpl::didNavigateWithinPage(
+ blink::WebLocalFrame* frame,
const blink::WebHistoryItem& item,
- blink::WebHistoryCommitType commit_type) {
+ blink::WebHistoryCommitType commit_type,
+ bool content_initiated) {
TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage",
"id", routing_id_);
DCHECK_EQ(frame_, frame);
- // If this was a reference fragment navigation that we initiated, then we
- // could end up having a non-null pending navigation params. We just need to
- // update the ExtraData on the datasource so that others who read the
- // ExtraData will get the new NavigationState. Similarly, if we did not
- // initiate this navigation, then we need to take care to reset any pre-
- // existing navigation state to a content-initiated navigation state.
- // UpdateNavigationState conveniently takes care of this for us.
+ // If this was a browser-initiated navigation, then there could be pending
+ // navigation params, so use them. Otherwise, just reset the document state
+ // here, since if pending navigation params exist they are for some other
+ // navigation <https://crbug.com/597239>.
DocumentState* document_state =
DocumentState::FromDataSource(frame->dataSource());
- UpdateNavigationState(document_state, true /* was_within_same_page */);
+ if (content_initiated) {
Charlie Reis 2016/05/12 20:51:48 Would it be better to put this fix inside UpdateNa
Avi (use Gerrit) 2016/05/12 23:41:17 Right now we don't know if it's browser-initiated
Charlie Reis 2016/05/13 00:46:17 I could be ok leaving it as a TODO for this CL and
Avi (use Gerrit) 2016/05/13 01:35:44 It's probably not difficult to plumb it too. I'll
Avi (use Gerrit) 2016/05/13 16:45:19 FYI, at the beginning of RenderFrameImpl::didCreat
Charlie Reis 2016/05/13 18:26:55 Ha! Ok, yes, let's revisit that case (and any oth
+ document_state->set_navigation_state(
+ NavigationStateImpl::CreateContentInitiated());
+ } else {
+ UpdateNavigationState(document_state, true /* was_within_same_page */);
+ }
static_cast<NavigationStateImpl*>(document_state->navigation_state())
->set_was_within_same_page(true);

Powered by Google App Engine
This is Rietveld 408576698