Remove transient entries

Transient navigation entries were only used for non-committed (overlay)
interstitials and a few tests. Since overlay interstitials have been
removed, this CL changes the tests to use regular entries, and removes
the transient entry concept.

Bug: 1077074

Change-Id: Ide09a628fae91a04308ae26efde7112f1e468250
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2149954
Auto-Submit: Carlos IL <[email protected]>
Commit-Queue: Camille Lamy <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: Charlie Reis <[email protected]>
Cr-Commit-Position: refs/heads/master@{#771811}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index ddb106d4..b8a495dd 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -155,12 +155,7 @@
                                    bool is_post,
                                    bool is_reload,
                                    bool is_navigation_to_existing_entry,
-                                   bool has_interstitial,
                                    NavigationEntryImpl* last_committed_entry) {
-  // Don't convert when an interstitial is showing.
-  if (has_interstitial)
-    return false;
-
   // Only convert main frame navigations to a new entry.
   if (!is_main_frame || is_reload || is_navigation_to_existing_entry)
     return false;
@@ -592,18 +587,6 @@
 void NavigationControllerImpl::Reload(ReloadType reload_type,
                                       bool check_for_repost) {
   DCHECK_NE(ReloadType::NONE, reload_type);
-
-  if (transient_entry_index_ != -1) {
-    // If an interstitial is showing, treat a reload as a navigation to the
-    // transient entry's URL.
-    NavigationEntryImpl* transient_entry = GetTransientEntry();
-    if (!transient_entry)
-      return;
-    LoadURL(transient_entry->GetURL(), Referrer(), ui::PAGE_TRANSITION_RELOAD,
-            transient_entry->extra_headers());
-    return;
-  }
-
   NavigationEntryImpl* entry = nullptr;
   int current_index = -1;
 
@@ -722,16 +705,12 @@
 }
 
 NavigationEntryImpl* NavigationControllerImpl::GetActiveEntry() {
-  if (transient_entry_index_ != -1)
-    return entries_[transient_entry_index_].get();
   if (pending_entry_)
     return pending_entry_;
   return GetLastCommittedEntry();
 }
 
 NavigationEntryImpl* NavigationControllerImpl::GetVisibleEntry() {
-  if (transient_entry_index_ != -1)
-    return entries_[transient_entry_index_].get();
   // The pending entry is safe to return for new (non-history), browser-
   // initiated navigations.  Most renderer-initiated navigations should not
   // show the pending entry, to prevent URL spoof attacks.
@@ -760,8 +739,6 @@
 }
 
 int NavigationControllerImpl::GetCurrentEntryIndex() {
-  if (transient_entry_index_ != -1)
-    return transient_entry_index_;
   if (pending_entry_index_ != -1)
     return pending_entry_index_;
   return last_committed_entry_index_;
@@ -784,16 +761,14 @@
 
 int NavigationControllerImpl::GetLastCommittedEntryIndex() {
   // The last committed entry index must always be less than the number of
-  // entries.  If there are no entries, it must be -1. However, there may be a
-  // transient entry while the last committed entry index is still -1.
+  // entries.  If there are no entries, it must be -1.
   DCHECK_LT(last_committed_entry_index_, GetEntryCount());
   DCHECK(GetEntryCount() || last_committed_entry_index_ == -1);
   return last_committed_entry_index_;
 }
 
 int NavigationControllerImpl::GetEntryCount() {
-  DCHECK_LE(entries_.size(),
-            max_entry_count() + (transient_entry_index_ == -1 ? 0 : 1));
+  DCHECK_LE(entries_.size(), max_entry_count());
   return static_cast<int>(entries_.size());
 }
 
@@ -906,17 +881,6 @@
     return;
   }
 
-  if (transient_entry_index_ != -1) {
-    if (index == transient_entry_index_) {
-      // Nothing to do when navigating to the transient.
-      return;
-    }
-    if (index > transient_entry_index_) {
-      // Removing the transient is goint to shift all entries by 1.
-      index--;
-    }
-  }
-
   DiscardNonCommittedEntries();
 
   DCHECK_EQ(nullptr, pending_entry_);
@@ -1743,8 +1707,7 @@
   if (!keep_pending_entry)
     DiscardNonCommittedEntries();
 
-  // If a transient entry was removed, the indices might have changed, so we
-  // have to query the entry index again.
+  // Update the last committed index to reflect the committed entry.
   last_committed_entry_index_ = GetIndexOfEntry(entry);
 }
 
@@ -2037,9 +2000,8 @@
   if (!replace_entry)
     source->PruneOldestSkippableEntryIfFull();
 
-  // Insert the entries from source. Don't use source->GetCurrentEntryIndex as
-  // we don't want to copy over the transient entry. Ignore any pending entry,
-  // since it has not committed in source.
+  // Insert the entries from source. Ignore any pending entry, since it has not
+  // committed in source.
   int max_source_index = source->last_committed_entry_index_;
   if (max_source_index == -1)
     max_source_index = source->GetEntryCount();
@@ -2075,10 +2037,6 @@
   if (pending_entry_index_ != -1)
     return false;
 
-  // We should not prune if we are currently showing a transient entry.
-  if (transient_entry_index_ != -1)
-    return false;
-
   return true;
 }
 
@@ -2482,18 +2440,8 @@
 void NavigationControllerImpl::RemoveEntryAtIndexInternal(int index) {
   DCHECK_LT(index, GetEntryCount());
   DCHECK_NE(index, last_committed_entry_index_);
-
-  const bool was_transient = index == transient_entry_index_;
-
   DiscardNonCommittedEntries();
 
-  if (was_transient) {
-    // There's nothing left to do if the index referred to a transient entry
-    // that we just discarded.
-    DCHECK(!GetTransientEntry());
-    return;
-  }
-
   entries_.erase(entries_.begin() + index);
   if (last_committed_entry_index_ > index)
     last_committed_entry_index_--;
@@ -2935,7 +2883,6 @@
           params.load_type ==
               NavigationController::LOAD_TYPE_HTTP_POST /* is_post */,
           false /* is_reload */, false /* is_navigation_to_existing_entry */,
-          transient_entry_index_ != -1 /* has_interstitial */,
           GetLastCommittedEntry())) {
     reload_type = ReloadType::NORMAL;
   }
@@ -3478,28 +3425,14 @@
   // Avoid sending a notification if there is nothing to discard.
   // TODO(mthiesse): Temporarily checking failed_pending_entry_id_ to help
   // diagnose https://bugs.chromium.org/p/chromium/issues/detail?id=1007570.
-  if (!pending_entry_ && transient_entry_index_ == -1 &&
-      failed_pending_entry_id_ == 0) {
+  if (!pending_entry_ && failed_pending_entry_id_ == 0) {
     return;
   }
-
   DiscardPendingEntry(false);
-  DiscardTransientEntry();
   if (delegate_)
     delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
 }
 
-void NavigationControllerImpl::DiscardTransientEntry() {
-  if (transient_entry_index_ == -1)
-    return;
-  entries_.erase(entries_.begin() + transient_entry_index_);
-  if (last_committed_entry_index_ > transient_entry_index_)
-    last_committed_entry_index_--;
-  if (pending_entry_index_ > transient_entry_index_)
-    pending_entry_index_--;
-  transient_entry_index_ = -1;
-}
-
 int NavigationControllerImpl::GetEntryIndexWithUniqueID(
     int nav_entry_id) const {
   for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) {
@@ -3509,27 +3442,6 @@
   return -1;
 }
 
-NavigationEntryImpl* NavigationControllerImpl::GetTransientEntry() {
-  if (transient_entry_index_ == -1)
-    return nullptr;
-  return entries_[transient_entry_index_].get();
-}
-
-void NavigationControllerImpl::SetTransientEntry(
-    std::unique_ptr<NavigationEntry> entry) {
-  // Discard any current transient entry, we can only have one at a time.
-  DiscardTransientEntry();
-  int index = 0;
-  if (last_committed_entry_index_ != -1)
-    index = last_committed_entry_index_ + 1;
-  entries_.insert(entries_.begin() + index,
-                  NavigationEntryImpl::FromNavigationEntry(std::move(entry)));
-  if (pending_entry_index_ >= index)
-    pending_entry_index_++;
-  transient_entry_index_ = index;
-  delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
-}
-
 void NavigationControllerImpl::InsertEntriesFrom(
     NavigationControllerImpl* source,
     int max_index) {
@@ -3639,8 +3551,6 @@
   // Do not leave the pending entry visible if it has an invalid URL, since this
   // might be formatted in an unexpected or unsafe way.
   // TODO(creis): Block navigations to invalid URLs in https://crbug.com/850824.
-  //
-  // Note: don't touch the transient entry, since an interstitial may exist.
   bool should_preserve_entry =
       (pending_entry_ == GetVisibleEntry()) &&
       pending_entry_->GetURL().is_valid() &&
diff --git a/content/browser/frame_host/navigation_controller_impl.h b/content/browser/frame_host/navigation_controller_impl.h
index e7ec7e7e..601f756 100644
--- a/content/browser/frame_host/navigation_controller_impl.h
+++ b/content/browser/frame_host/navigation_controller_impl.h
@@ -93,8 +93,6 @@
   void DiscardNonCommittedEntries() override;
   NavigationEntryImpl* GetPendingEntry() override;
   int GetPendingEntryIndex() override;
-  NavigationEntryImpl* GetTransientEntry() override;
-  void SetTransientEntry(std::unique_ptr<NavigationEntry> entry) override;
   void LoadURL(const GURL& url,
                const Referrer& referrer,
                ui::PageTransition type,
@@ -507,9 +505,6 @@
   // Removes the entry at |index|, as long as it is not the current entry.
   void RemoveEntryAtIndexInternal(int index);
 
-  // Discards only the transient entry.
-  void DiscardTransientEntry();
-
   // If we have the maximum number of entries, remove the oldest entry that is
   // marked to be skipped on back/forward button, in preparation to add another.
   // If no entry is skippable, then the oldest entry will be pruned.
@@ -524,8 +519,7 @@
 
   // Inserts up to |max_index| entries from |source| into this. This does NOT
   // adjust any of the members that reference entries_
-  // (last_committed_entry_index_, pending_entry_index_ or
-  // transient_entry_index_).
+  // (last_committed_entry_index_ or pending_entry_index_)
   void InsertEntriesFrom(NavigationControllerImpl* source, int max_index);
 
   // Returns the navigation index that differs from the current entry by the
@@ -603,13 +597,6 @@
   // pending_entry_ is a new entry (created by LoadURL).
   int pending_entry_index_ = -1;
 
-  // The index for the entry that is shown until a navigation occurs.  This is
-  // used for interstitial pages. -1 if there are no such entry.
-  // Note that this entry really appears in the list of entries, but only
-  // temporarily (until the next navigation).  Any index pointing to an entry
-  // after the transient entry will become invalid if you navigate forward.
-  int transient_entry_index_ = -1;
-
   // The delegate associated with the controller. Possibly NULL during
   // setup.
   NavigationControllerDelegate* delegate_;
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
index ea263eeb..3a71653 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -2573,269 +2573,6 @@
   EXPECT_FALSE(controller.GetPendingEntry());
 }
 
-// Tests the transient entry, making sure it goes away with all navigations.
-TEST_F(NavigationControllerTest, TransientEntry) {
-  NavigationControllerImpl& controller = controller_impl();
-
-  const GURL url0("http://foo/0");
-  const GURL url1("http://foo/1");
-  const GURL url2("http://foo/2");
-  const GURL url3("http://foo/3");
-  const GURL url3_ref("http://foo/3#bar");
-  const GURL url4("http://foo/4");
-  const GURL transient_url("http://foo/transient");
-
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url0);
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url1);
-
-  navigation_entry_changed_counter_ = 0;
-  navigation_list_pruned_counter_ = 0;
-
-  // Adding a transient with no pending entry.
-  std::unique_ptr<NavigationEntry> transient_entry(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-
-  // We should not have received any notifications.
-  EXPECT_EQ(0U, navigation_entry_changed_counter_);
-  EXPECT_EQ(0U, navigation_list_pruned_counter_);
-
-  // Check our state.
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 3);
-  EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1);
-  EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
-  EXPECT_TRUE(controller.GetLastCommittedEntry());
-  EXPECT_FALSE(controller.GetPendingEntry());
-  EXPECT_TRUE(controller.CanGoBack());
-  EXPECT_FALSE(controller.CanGoForward());
-
-  // Navigate.
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url2);
-
-  // We should have navigated, transient entry should be gone.
-  EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 3);
-
-  // Add a transient again, then navigate with no pending entry this time.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  NavigationSimulator::NavigateAndCommitFromDocument(url3, main_test_rfh());
-  // Transient entry should be gone.
-  EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 4);
-
-  // Initiate a navigation, add a transient then commit navigation.
-  auto navigation =
-      NavigationSimulator::CreateBrowserInitiated(url4, contents());
-  navigation->Start();
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  navigation->Commit();
-  EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 5);
-
-  // Add a transient and go back.  This should simply remove the transient.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_TRUE(controller.CanGoBack());
-  EXPECT_FALSE(controller.CanGoForward());
-  controller.GoBack();
-  // Transient entry should be gone.
-  EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 5);
-
-  // Suppose the page requested a history navigation backward.
-  NavigationSimulator::GoBack(contents());
-
-  // Add a transient and go to an entry before the current one.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  controller.GoToIndex(1);
-  auto history_navigation1 = NavigationSimulator::CreateFromPending(contents());
-  // The navigation should have been initiated, transient entry should be gone.
-  EXPECT_FALSE(controller.GetTransientEntry());
-  EXPECT_EQ(url1, controller.GetPendingEntry()->GetURL());
-  // Visible entry does not update for history navigations until commit.
-  EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL());
-  history_navigation1->Commit();
-  EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
-
-  // Add a transient and go to an entry after the current one.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  controller.GoToIndex(3);
-  auto history_navigation2 = NavigationSimulator::CreateFromPending(contents());
-  // The navigation should have been initiated, transient entry should be gone.
-  // Because of the transient entry that is removed, going to index 3 makes us
-  // land on url2 (which is visible after the commit).
-  EXPECT_EQ(url2, controller.GetPendingEntry()->GetURL());
-  EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
-  history_navigation2->Commit();
-  EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL());
-
-  // Add a transient and go forward.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_TRUE(controller.CanGoForward());
-  auto forward_navigation =
-      NavigationSimulator::CreateHistoryNavigation(1, contents());
-  forward_navigation->Start();
-  // We should have navigated, transient entry should be gone.
-  EXPECT_FALSE(controller.GetTransientEntry());
-  EXPECT_EQ(url3, controller.GetPendingEntry()->GetURL());
-  EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL());
-  forward_navigation->Commit();
-  EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL());
-
-  // Add a transient and do an in-page navigation, replacing the current entry.
-  transient_entry.reset(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-
-  main_test_rfh()->SendNavigate(0, false, url3_ref);
-  // Transient entry should be gone.
-  EXPECT_FALSE(controller.GetTransientEntry());
-  EXPECT_EQ(url3_ref, controller.GetVisibleEntry()->GetURL());
-
-  // Ensure the URLs are correct.
-  EXPECT_EQ(controller.GetEntryCount(), 5);
-  EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0);
-  EXPECT_EQ(controller.GetEntryAtIndex(1)->GetURL(), url1);
-  EXPECT_EQ(controller.GetEntryAtIndex(2)->GetURL(), url2);
-  EXPECT_EQ(controller.GetEntryAtIndex(3)->GetURL(), url3_ref);
-  EXPECT_EQ(controller.GetEntryAtIndex(4)->GetURL(), url4);
-}
-
-// Test that RemoveEntryAtIndex can handle an index that refers to a transient
-// entry.
-TEST_F(NavigationControllerTest, RemoveTransientByIndex) {
-  NavigationControllerImpl& controller = controller_impl();
-  const GURL url0("http://foo/0");
-  const GURL transient_url("http://foo/transient");
-
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url0);
-
-  std::unique_ptr<NavigationEntry> transient_entry =
-      std::make_unique<NavigationEntryImpl>();
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 2);
-  EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0);
-  EXPECT_TRUE(controller.GetTransientEntry());
-  EXPECT_EQ(controller.GetTransientEntry(), controller.GetEntryAtIndex(1));
-
-  EXPECT_TRUE(controller.RemoveEntryAtIndex(1));
-
-  EXPECT_EQ(controller.GetEntryCount(), 1);
-  EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0);
-  EXPECT_FALSE(controller.GetTransientEntry());
-}
-
-// Test that Reload initiates a new navigation to a transient entry's URL.
-TEST_F(NavigationControllerTest, ReloadTransient) {
-  NavigationControllerImpl& controller = controller_impl();
-  const GURL url0("http://foo/0");
-  const GURL url1("http://foo/1");
-  const GURL transient_url("http://foo/transient");
-
-  // Load |url0|, and start a pending navigation to |url1|.
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url0);
-  auto navigation =
-      NavigationSimulator::CreateBrowserInitiated(url1, contents());
-  navigation->Start();
-
-  // A transient entry is added, interrupting the navigation.
-  std::unique_ptr<NavigationEntry> transient_entry(new NavigationEntryImpl);
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-  EXPECT_TRUE(controller.GetTransientEntry());
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-
-  // The page is reloaded, which should remove the pending entry for |url1| and
-  // the transient entry for |transient_url|, and start a navigation to
-  // |transient_url|.
-  controller.Reload(ReloadType::NORMAL, true);
-  EXPECT_FALSE(controller.GetTransientEntry());
-  EXPECT_TRUE(controller.GetPendingEntry());
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  ASSERT_EQ(controller.GetEntryCount(), 1);
-  EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0);
-
-  // Load of |transient_url| completes.
-  auto reload = NavigationSimulator::CreateFromPending(contents());
-  reload->Commit();
-  ASSERT_EQ(controller.GetEntryCount(), 2);
-  EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0);
-  EXPECT_EQ(controller.GetEntryAtIndex(1)->GetURL(), transient_url);
-}
-
-// Ensure that adding a transient entry works when history is full.
-TEST_F(NavigationControllerTest, TransientEntryWithFullHistory) {
-  NavigationControllerImpl& controller = controller_impl();
-
-  const GURL url0("http://foo/0");
-  const GURL url1("http://foo/1");
-  const GURL url2("http://foo/2");
-  const GURL transient_url("http://foo/transient");
-
-  // Maximum count should be at least 2 or we will not be able to perform
-  // another navigation, since it would need to prune the last committed entry
-  // which is not safe.
-  controller.set_max_entry_count_for_testing(2);
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url0);
-  NavigationSimulator::NavigateAndCommitFromBrowser(contents(), url1);
-
-  // Add a transient entry beyond entry count limit.
-  auto transient_entry = std::make_unique<NavigationEntryImpl>();
-  transient_entry->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(transient_entry));
-
-  // Check our state.
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 3);
-  EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1);
-  EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
-  EXPECT_TRUE(controller.GetLastCommittedEntry());
-  EXPECT_FALSE(controller.GetPendingEntry());
-  EXPECT_TRUE(controller.CanGoBack());
-  EXPECT_FALSE(controller.CanGoForward());
-
-  // Go back, removing the transient entry.
-  controller.GoBack();
-  EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 2);
-
-  // Initiate a navigation, then add a transient entry with the pending entry
-  // present.
-  auto navigation =
-      NavigationSimulator::CreateBrowserInitiated(url2, contents());
-  navigation->Start();
-  auto another_transient = std::make_unique<NavigationEntryImpl>();
-  another_transient->SetURL(transient_url);
-  controller.SetTransientEntry(std::move(another_transient));
-  EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 3);
-  navigation->Commit();
-  EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL());
-  EXPECT_EQ(controller.GetEntryCount(), 2);
-}
-
 // Ensure that renderer initiated pending entries get replaced, so that we
 // don't show a stale virtual URL when a navigation commits.
 // See http://crbug.com/266922.
@@ -3350,25 +3087,6 @@
   EXPECT_EQ(1, clone->GetController().GetPendingEntryIndex());
 }
 
-// Make sure that cloning a WebContentsImpl doesn't copy interstitials.
-TEST_F(NavigationControllerTest, CloneOmitsInterstitials) {
-  NavigationControllerImpl& controller = controller_impl();
-  const GURL url1("http://foo1");
-  const GURL url2("http://foo2");
-
-  NavigateAndCommit(url1);
-  NavigateAndCommit(url2);
-
-  // Add an interstitial entry.  Should be deleted with controller.
-  NavigationEntryImpl* interstitial_entry = new NavigationEntryImpl();
-  interstitial_entry->set_page_type(PAGE_TYPE_INTERSTITIAL);
-  controller.SetTransientEntry(base::WrapUnique(interstitial_entry));
-
-  std::unique_ptr<WebContents> clone(controller.GetWebContents()->Clone());
-
-  ASSERT_EQ(2, clone->GetController().GetEntryCount());
-}
-
 // Test requesting and triggering a lazy reload.
 TEST_F(NavigationControllerTest, LazyReload) {
   NavigationControllerImpl& controller = controller_impl();
@@ -4521,84 +4239,6 @@
   EXPECT_EQ(url_b, controller.GetEntryAtIndex(2)->GetURL());
 }
 
-// Test to ensure that the pending entry index is updated when a transient entry
-// is inserted or removed.
-TEST_F(NavigationControllerTest, PendingEntryIndexUpdatedWithTransient) {
-  NavigationControllerImpl& controller = controller_impl();
-  const GURL url_0("http://foo/0");
-  const GURL url_1("http://foo/1");
-  const GURL url_transient_1("http://foo/transient_1");
-  const GURL url_transient_2("http://foo/transient_2");
-
-  NavigateAndCommit(url_0);
-  NavigateAndCommit(url_1);
-  controller.GoBack();
-  contents()->CommitPendingNavigation();
-  controller.GoForward();
-
-  // Check the state before the insertion of the transient entry.
-  // entries[0] = url_0  <- last committed entry.
-  // entries[1] = url_1  <- pending entry.
-  ASSERT_EQ(2, controller.GetEntryCount());
-  EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
-  EXPECT_EQ(1, controller.GetPendingEntryIndex());
-  EXPECT_EQ(controller.GetEntryAtIndex(1), controller.GetPendingEntry());
-  EXPECT_EQ(url_0, controller.GetEntryAtIndex(0)->GetURL());
-  EXPECT_EQ(url_1, controller.GetEntryAtIndex(1)->GetURL());
-
-  // Insert a transient entry before the pending one. It should increase the
-  // pending entry index by one (1 -> 2).
-  std::unique_ptr<NavigationEntry> transient_entry_1(new NavigationEntryImpl);
-  transient_entry_1->SetURL(url_transient_1);
-  controller.SetTransientEntry(std::move(transient_entry_1));
-
-  // Check the state after the insertion of the transient entry.
-  // entries[0] = url_0           <- last committed entry
-  // entries[1] = url_transient_1 <- transient entry
-  // entries[2] = url_1           <- pending entry
-  ASSERT_EQ(3, controller.GetEntryCount());
-  EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
-  EXPECT_EQ(2, controller.GetPendingEntryIndex());
-  EXPECT_EQ(controller.GetEntryAtIndex(1), controller.GetTransientEntry());
-  EXPECT_EQ(controller.GetEntryAtIndex(2), controller.GetPendingEntry());
-  EXPECT_EQ(url_0, controller.GetEntryAtIndex(0)->GetURL());
-  EXPECT_EQ(url_transient_1, controller.GetEntryAtIndex(1)->GetURL());
-  EXPECT_EQ(url_1, controller.GetEntryAtIndex(2)->GetURL());
-
-  // Insert another transient entry. It should replace the previous one and this
-  // time the pending entry index should retain its value (i.e. 2).
-  std::unique_ptr<NavigationEntry> transient_entry_2(new NavigationEntryImpl);
-  transient_entry_2->SetURL(url_transient_2);
-  controller.SetTransientEntry(std::move(transient_entry_2));
-
-  // Check the state after the second insertion of a transient entry.
-  // entries[0] = url_0           <- last committed entry
-  // entries[1] = url_transient_2 <- transient entry
-  // entries[2] = url_1           <- pending entry
-  ASSERT_EQ(3, controller.GetEntryCount());
-  EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
-  EXPECT_EQ(2, controller.GetPendingEntryIndex());
-  EXPECT_EQ(controller.GetEntryAtIndex(1), controller.GetTransientEntry());
-  EXPECT_EQ(controller.GetEntryAtIndex(2), controller.GetPendingEntry());
-  EXPECT_EQ(url_0, controller.GetEntryAtIndex(0)->GetURL());
-  EXPECT_EQ(url_transient_2, controller.GetEntryAtIndex(1)->GetURL());
-  EXPECT_EQ(url_1, controller.GetEntryAtIndex(2)->GetURL());
-
-  // Commit the pending entry.
-  contents()->CommitPendingNavigation();
-
-  // Check the final state.
-  // entries[0] = url_0
-  // entries[1] = url_1  <- last committed entry
-  ASSERT_EQ(2, controller.GetEntryCount());
-  EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
-  EXPECT_EQ(-1, controller.GetPendingEntryIndex());
-  EXPECT_EQ(nullptr, controller.GetPendingEntry());
-  EXPECT_EQ(nullptr, controller.GetTransientEntry());
-  EXPECT_EQ(url_0, controller.GetEntryAtIndex(0)->GetURL());
-  EXPECT_EQ(url_1, controller.GetEntryAtIndex(1)->GetURL());
-}
-
 // Tests that NavigationUIData has been passed to the NavigationHandle.
 TEST_F(NavigationControllerTest, MainFrameNavigationUIData) {
   LoadCommittedDetailsObserver observer(contents());
@@ -4757,7 +4397,6 @@
   const GURL url_1("http://foo/1");
   const GURL url_2("http://foo/2");
   const GURL url_3("http://foo/3");
-  const GURL url_transient("http://foo/transient");
 
   NavigateAndCommit(url_0);
   NavigateAndCommit(url_1);
@@ -4797,10 +4436,6 @@
 
   EXPECT_EQ(1, controller.GetPendingEntryIndex());
   EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
-  // Insert a transient entry before the pending one.
-  std::unique_ptr<NavigationEntry> transient_entry(new NavigationEntryImpl);
-  transient_entry->SetURL(url_transient);
-  controller.SetTransientEntry(std::move(transient_entry));
 
   state_change_count = delegate->navigation_state_change_count();
   controller.PruneForwardEntries();
@@ -4812,7 +4447,6 @@
   EXPECT_EQ(0, controller.GetCurrentEntryIndex());
   EXPECT_EQ(-1, controller.GetPendingEntryIndex());
   EXPECT_EQ(nullptr, controller.GetPendingEntry());
-  EXPECT_EQ(nullptr, controller.GetTransientEntry());
   EXPECT_EQ(url_0, controller.GetVisibleEntry()->GetURL());
   EXPECT_EQ(1U, navigation_list_pruned_counter_);
   EXPECT_EQ(1, last_navigation_entry_pruned_details_.index);
diff --git a/content/browser/frame_host/navigator.cc b/content/browser/frame_host/navigator.cc
index e052b64..5c4a1a6 100644
--- a/content/browser/frame_host/navigator.cc
+++ b/content/browser/frame_host/navigator.cc
@@ -805,12 +805,6 @@
   if (renderer_provisional_load_to_pending_url)
     return nullptr;
 
-  // If there is a transient entry, creating a new pending entry will result
-  // in deleting it, which leads to inconsistent state.
-  bool has_transient_entry = !!controller_->GetTransientEntry();
-  if (has_transient_entry)
-    return nullptr;
-
   // Since GetNavigationEntryForRendererInitiatedNavigation is called from
   // OnBeginNavigation, we can assume that no frame proxies are involved and
   // therefore that |current_site_instance| is also the |source_site_instance|.
diff --git a/content/browser/portal/portal.cc b/content/browser/portal/portal.cc
index a3085b2..2a447d3 100644
--- a/content/browser/portal/portal.cc
+++ b/content/browser/portal/portal.cc
@@ -350,7 +350,6 @@
   // restriction.
   DCHECK_EQ(PAGE_TYPE_NORMAL,
             predecessor_controller.GetLastCommittedEntry()->GetPageType());
-  DCHECK(!predecessor_controller.GetTransientEntry());
 
   // If the portal is showing an error page, reject activation.
   if (portal_controller.GetLastCommittedEntry()->GetPageType() !=
@@ -359,7 +358,6 @@
         blink::mojom::PortalActivateResult::kRejectedDueToErrorInPortal);
     return;
   }
-  DCHECK(!portal_controller.GetTransientEntry());
 
   // If a navigation in the main frame is occurring, stop it if possible and
   // reject the activation if it's too late or if an ongoing navigation takes
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 955cf04..0f7b67e 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1389,20 +1389,13 @@
 #endif
 
 const base::string16& WebContentsImpl::GetTitle() {
-  // Transient entries take precedence. They are used for interstitial pages
-  // that are shown on top of existing pages.
-  NavigationEntry* entry = controller_.GetTransientEntry();
-  if (entry) {
-    return entry->GetTitleForDisplay();
-  }
-
   WebUI* our_web_ui =
       GetRenderManager()->speculative_frame_host()
           ? GetRenderManager()->speculative_frame_host()->web_ui()
           : GetRenderManager()->current_frame_host()->web_ui();
   if (our_web_ui) {
     // Don't override the title in view source mode.
-    entry = controller_.GetVisibleEntry();
+    NavigationEntry* entry = controller_.GetVisibleEntry();
     if (!(entry && entry->IsViewSourceMode())) {
       // Give the Web UI the chance to override our title.
       const base::string16& title = our_web_ui->GetOverriddenTitle();
@@ -1415,7 +1408,7 @@
   // navigation entry. For example, when the user types in a URL, we want to
   // keep the old page's title until the new load has committed and we get a new
   // title.
-  entry = controller_.GetLastCommittedEntry();
+  NavigationEntry* entry = controller_.GetLastCommittedEntry();
 
   // We make an exception for initial navigations. We only want to use the title
   // from the visible entry if:
diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h
index 754d13e9..e9c8494 100644
--- a/content/public/browser/navigation_controller.h
+++ b/content/public/browser/navigation_controller.h
@@ -294,24 +294,18 @@
   // has not been responded to, the NavigationEntry is pending. Once data is
   // received for that entry, that NavigationEntry is committed.
 
-  // A transient entry is an entry that, when the user navigates away, is
-  // removed and discarded rather than being added to the back-forward list.
-  // Transient entries are useful for interstitial pages and the like.
-
   // Active entry --------------------------------------------------------------
 
   // THIS IS DEPRECATED. DO NOT USE. Use GetVisibleEntry instead.
   // See http://crbug.com/273710.
   //
-  // Returns the active entry, which is the transient entry if any, the pending
-  // entry if a navigation is in progress or the last committed entry otherwise.
-  // NOTE: This can be nullptr!!
+  // Returns the active entry, which is the pending entry if a navigation is in
+  // progress or the last committed entry otherwise. NOTE: This can be nullptr!!
   virtual NavigationEntry* GetActiveEntry() = 0;
 
   // Returns the entry that should be displayed to the user in the address bar.
-  // This is the transient entry if any, the pending entry if a navigation is
-  // in progress *and* is safe to display to the user (see below), or the last
-  // committed entry otherwise.
+  // This is the pending entry if a navigation is in progress *and* is safe to
+  // display to the user (see below), or the last committed entry otherwise.
   // NOTE: This can be nullptr if no entry has committed!
   //
   // A pending entry is safe to display if it started in the browser process or
@@ -329,8 +323,7 @@
   virtual NavigationEntry* GetLastCommittedEntry() = 0;
 
   // Returns the index of the last committed entry.  It will be -1 if there are
-  // no entries, or if there is a transient entry before the first entry
-  // commits.
+  // no entries.
   virtual int GetLastCommittedEntryIndex() = 0;
 
   // Returns true if the source for the current entry can be viewed.
@@ -339,8 +332,7 @@
   // Navigation list -----------------------------------------------------------
 
   // Returns the number of entries in the NavigationController, excluding
-  // the pending entry if there is one, but including the transient entry if
-  // any.
+  // the pending entry if there is one.
   virtual int GetEntryCount() = 0;
 
   virtual NavigationEntry* GetEntryAtIndex(int index) = 0;
@@ -351,7 +343,7 @@
 
   // Pending entry -------------------------------------------------------------
 
-  // Discards the pending and transient entries if any.
+  // Discards the pending entry if any.
   virtual void DiscardNonCommittedEntries() = 0;
 
   // Returns the pending entry corresponding to the navigation that is
@@ -362,22 +354,6 @@
   // corresponds to a new navigation (created via LoadURL).
   virtual int GetPendingEntryIndex() = 0;
 
-  // Transient entry -----------------------------------------------------------
-
-  // Returns the transient entry if any. This is an entry which is removed and
-  // discarded if any navigation occurs. Note that the returned entry is owned
-  // by the navigation controller and may be deleted at any time.
-  virtual NavigationEntry* GetTransientEntry() = 0;
-
-  // Adds an entry that is returned by GetActiveEntry(). The entry is
-  // transient: any navigation causes it to be removed and discarded.  The
-  // NavigationController becomes the owner of |entry| and deletes it when
-  // it discards it. This is useful with interstitial pages that need to be
-  // represented as an entry, but should go away when the user navigates away
-  // from them.
-  // Note that adding a transient entry does not change the active contents.
-  virtual void SetTransientEntry(std::unique_ptr<NavigationEntry> entry) = 0;
-
   // New navigations -----------------------------------------------------------
 
   // Loads the specified URL, specifying extra http headers to add to the
@@ -428,8 +404,7 @@
   // |check_for_repost| is true and the current entry has POST data the user is
   // prompted to see if they really want to reload the page.  In nearly all
   // cases pass in true in production code, but would do false for testing, or
-  // in cases where no user interface is available for prompting.  If a
-  // transient entry is showing, initiates a new navigation to its URL.
+  // in cases where no user interface is available for prompting.
   // NOTE: |reload_type| should never be NONE.
   virtual void Reload(ReloadType reload_type, bool check_for_repost) = 0;
 
@@ -437,11 +412,11 @@
 
   // Removes the entry at the specified |index|.  If the index is the last
   // committed index or the pending entry, this does nothing and returns false.
-  // Otherwise this call discards any transient or pending entries.
+  // Otherwise this call discards any pending entry.
   virtual bool RemoveEntryAtIndex(int index) = 0;
 
-  // Discards any transient or pending entries, then discards all entries after
-  // the current entry index.
+  // Discards any pending entry, then discards all entries after the current
+  // entry index.
   virtual void PruneForwardEntries() = 0;
 
   // Random --------------------------------------------------------------------
@@ -500,23 +475,20 @@
   // If there is a pending entry after *G* in |this|, it is also preserved.
   // If |replace_entry| is true, the current entry in |source| is replaced. So
   // the result above would be A B *G*.
-  // This ignores any pending or transient entries in |source|.  Callers must
-  // ensure that |CanPruneAllButLastCommitted| returns true before calling this,
-  // or it will crash.
+  // This ignores any pending entry in |source|.  Callers must ensure that
+  // |CanPruneAllButLastCommitted| returns true before calling this, or it will
+  // crash.
   virtual void CopyStateFromAndPrune(NavigationController* source,
                                      bool replace_entry) = 0;
 
   // Returns whether it is safe to call PruneAllButLastCommitted or
-  // CopyStateFromAndPrune.  There must be a last committed entry, no transient
-  // entry, and if there is a pending entry, it must be new and not an existing
-  // entry.
+  // CopyStateFromAndPrune.  There must be a last committed entry, and if there
+  // is a pending entry, it must be new and not an existing entry.
   //
   // If there were no last committed entry, the pending entry might not commit,
   // leaving us with a blank page.  This is unsafe when used with
   // |CopyStateFromAndPrune|, which would show an existing entry above the blank
   // page.
-  // If there were a transient entry, we would not want to prune the other
-  // entries, which the transient entry could be referring to.
   // If there were an existing pending entry, we could not prune the last
   // committed entry, in case it did not commit.  That would leave us with no
   // sensible place to put the pending entry when it did commit, after all other