| 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 2229ff0952c79f9f8b9d32bb552f026c7c78cb48..267b10e34f709ffaac70b2e947417ab4b6134478 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl.cc
|
| @@ -1651,17 +1651,23 @@ void NavigationControllerImpl::InsertOrReplaceEntry(
|
| DiscardNonCommittedEntriesInternal();
|
|
|
| int current_size = static_cast<int>(entries_.size());
|
| - DCHECK_IMPLIES(replace, current_size > 0);
|
| +
|
| + // When replacing, don't prune the forward history.
|
| + if (replace) {
|
| + DCHECK_GT(current_size, 0);
|
| + int32 page_id = entry->GetPageID();
|
| + entries_[last_committed_entry_index_] = entry.release();
|
| +
|
| + // This is a new page ID, so we need everybody to know about it.
|
| + delegate_->UpdateMaxPageID(page_id);
|
| + return;
|
| + }
|
|
|
| if (current_size > 0) {
|
| // Prune any entries which are in front of the current entry.
|
| - // Also prune the current entry if we are to replace the current entry.
|
| // last_committed_entry_index_ must be updated here since calls to
|
| // NotifyPrunedEntries() below may re-enter and we must make sure
|
| // last_committed_entry_index_ is not left in an invalid state.
|
| - if (replace)
|
| - --last_committed_entry_index_;
|
| -
|
| int num_pruned = 0;
|
| while (last_committed_entry_index_ < (current_size - 1)) {
|
| num_pruned++;
|
|
|