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

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

Issue 1250163002: Fix cross-process location.replace for main frames and subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove some code Created 4 years, 11 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/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 1f6bee16a09cc040479e81e7ccd598c0c53c5628..168cff09ad88428117cb9c009063ce99aa20366b 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -847,12 +847,19 @@ bool NavigationControllerImpl::RendererDidNavigate(
// If this is an error load, we may have already removed the pending entry
// when we got the notice of the load failure. If so, look at the copy of the
// pending parameters that were saved.
+ //
+ // TODO(creis): This block should be unnecessary now that we pass
+ // params.should_replace_current_entry. Remove it once we verify with the
+ // check below.
if (params.url_is_unreachable && failed_pending_entry_id_ != 0) {
details->did_replace_entry = failed_pending_entry_should_replace_;
} else {
- details->did_replace_entry = pending_entry_ &&
- pending_entry_->should_replace_entry();
+ details->did_replace_entry = (pending_entry_ &&
+ pending_entry_->should_replace_entry());
}
+ CHECK(!details->did_replace_entry || params.should_replace_current_entry);
+ if (params.should_replace_current_entry)
+ details->did_replace_entry = true;
// Do navigation-type specific actions. These will make and commit an entry.
details->type = ClassifyNavigation(rfh, params);
@@ -873,7 +880,7 @@ bool NavigationControllerImpl::RendererDidNavigate(
RendererDidNavigateToSamePage(rfh, params);
break;
case NAVIGATION_TYPE_NEW_SUBFRAME:
- RendererDidNavigateNewSubframe(rfh, params);
+ RendererDidNavigateNewSubframe(rfh, params, details->did_replace_entry);
break;
case NAVIGATION_TYPE_AUTO_SUBFRAME:
if (!RendererDidNavigateAutoSubframe(rfh, params))
@@ -1256,7 +1263,8 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
void NavigationControllerImpl::RendererDidNavigateNewSubframe(
RenderFrameHostImpl* rfh,
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
+ bool replace_entry) {
DCHECK(ui::PageTransitionCoreTypeIs(params.transition,
ui::PAGE_TRANSITION_MANUAL_SUBFRAME));
@@ -1286,7 +1294,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
}
new_entry->SetPageID(params.page_id);
- InsertOrReplaceEntry(std::move(new_entry), false);
+ InsertOrReplaceEntry(std::move(new_entry), replace_entry);
}
bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(

Powered by Google App Engine
This is Rietveld 408576698