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

Side by Side Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 23978003: Delete unneeded pending entries in DidFailProvisionalLoad to prevent a spoof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only clear the pending entry, not the transient. Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/navigation_controller_impl.h" 5 #include "content/browser/web_contents/navigation_controller_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" // Temporary 10 #include "base/strings/string_number_conversions.h" // Temporary
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 RestoreType type) { 1616 RestoreType type) {
1617 DCHECK(selected_index >= 0 && selected_index < GetEntryCount()); 1617 DCHECK(selected_index >= 0 && selected_index < GetEntryCount());
1618 ConfigureEntriesForRestore(&entries_, type); 1618 ConfigureEntriesForRestore(&entries_, type);
1619 1619
1620 SetMaxRestoredPageID(static_cast<int32>(GetEntryCount())); 1620 SetMaxRestoredPageID(static_cast<int32>(GetEntryCount()));
1621 1621
1622 last_committed_entry_index_ = selected_index; 1622 last_committed_entry_index_ = selected_index;
1623 } 1623 }
1624 1624
1625 void NavigationControllerImpl::DiscardNonCommittedEntriesInternal() { 1625 void NavigationControllerImpl::DiscardNonCommittedEntriesInternal() {
1626 DiscardPendingEntry();
1627 DiscardTransientEntry();
1628 }
1629
1630 void NavigationControllerImpl::DiscardPendingEntry() {
1626 if (pending_entry_index_ == -1) 1631 if (pending_entry_index_ == -1)
1627 delete pending_entry_; 1632 delete pending_entry_;
1628 pending_entry_ = NULL; 1633 pending_entry_ = NULL;
1629 pending_entry_index_ = -1; 1634 pending_entry_index_ = -1;
1630
1631 DiscardTransientEntry();
1632 } 1635 }
1633 1636
1634 void NavigationControllerImpl::DiscardTransientEntry() { 1637 void NavigationControllerImpl::DiscardTransientEntry() {
1635 if (transient_entry_index_ == -1) 1638 if (transient_entry_index_ == -1)
1636 return; 1639 return;
1637 entries_.erase(entries_.begin() + transient_entry_index_); 1640 entries_.erase(entries_.begin() + transient_entry_index_);
1638 if (last_committed_entry_index_ > transient_entry_index_) 1641 if (last_committed_entry_index_ > transient_entry_index_)
1639 last_committed_entry_index_--; 1642 last_committed_entry_index_--;
1640 transient_entry_index_ = -1; 1643 transient_entry_index_ = -1;
1641 } 1644 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 } 1687 }
1685 } 1688 }
1686 } 1689 }
1687 1690
1688 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1691 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1689 const base::Callback<base::Time()>& get_timestamp_callback) { 1692 const base::Callback<base::Time()>& get_timestamp_callback) {
1690 get_timestamp_callback_ = get_timestamp_callback; 1693 get_timestamp_callback_ = get_timestamp_callback;
1691 } 1694 }
1692 1695
1693 } // namespace content 1696 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698