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

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

Issue 1048963002: Fix incorrect creation of duplicate navigation entries for repeated page load failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@committype3
Patch Set: works Created 5 years, 9 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 8ec8dc91047a1ab77effedcb448046b9479f3d1e..49c80aad65b95c32c6187dad51f4aef145c16ba4 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -796,11 +796,15 @@ bool NavigationControllerImpl::RendererDidNavigate(
// If we are doing a cross-site reload, we need to replace the existing
// navigation entry, not add another entry to the history. This has the side
- // effect of removing forward browsing history, if such existed.
- // Or if we are doing a cross-site redirect navigation,
- // we will do a similar thing.
- details->did_replace_entry =
- pending_entry_ && pending_entry_->should_replace_entry();
+ // effect of removing forward browsing history, if such existed. Or if we are
+ // doing a cross-site redirect navigation, we will do a similar thing.
+ if (params.url_is_unreachable) {
Charlie Reis 2015/04/03 20:59:46 Should this be params.url_is_unreachable && failed
Avi (use Gerrit) 2015/04/06 19:38:16 I'm trying to come up with a scenario in which the
Charlie Reis 2015/04/06 20:48:10 The multiple frames thing is a different issue, an
Avi (use Gerrit) 2015/04/06 21:30:14 Yeah, I got it. The pending entry isn't guaranteed
+ details->did_replace_entry = failed_pending_entry_.get() &&
+ failed_pending_entry_->should_replace_entry();
+ } else {
+ details->did_replace_entry = pending_entry_ &&
+ pending_entry_->should_replace_entry();
+ }
// Do navigation-type specific actions. These will make and commit an entry.
details->type = ClassifyNavigation(rfh, params);
@@ -1758,21 +1762,28 @@ void NavigationControllerImpl::FinishRestore(int selected_index,
}
void NavigationControllerImpl::DiscardNonCommittedEntriesInternal() {
- DiscardPendingEntry();
+ DiscardPendingEntry(false);
DiscardTransientEntry();
}
-void NavigationControllerImpl::DiscardPendingEntry() {
+void NavigationControllerImpl::DiscardPendingEntry(bool was_failure) {
// It is not safe to call DiscardPendingEntry while NavigateToEntry is in
// progress, since this will cause a use-after-free. (We only allow this
// when the tab is being destroyed for shutdown, since it won't return to
// NavigateToEntry in that case.) http://crbug.com/347742.
CHECK(!in_navigate_to_pending_entry_ || delegate_->IsBeingDestroyed());
- if (pending_entry_index_ == -1)
- delete pending_entry_;
+ if (pending_entry_index_ == -1) {
+ if (was_failure)
+ failed_pending_entry_.reset(pending_entry_);
+ else
+ delete pending_entry_;
+ }
+
pending_entry_ = NULL;
pending_entry_index_ = -1;
+ if (!was_failure)
+ failed_pending_entry_.reset();
Charlie Reis 2015/04/03 20:59:46 You've confirmed this gets cleared after the error
Avi (use Gerrit) 2015/04/06 19:38:16 Yes, this gets cleared by the DiscardNonCommittedE
}
void NavigationControllerImpl::DiscardTransientEntry() {

Powered by Google App Engine
This is Rietveld 408576698