Bug 1487296 - Merge nsISHistoryInternal into nsISHistory. r=nika
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 30 Aug 2018 11:37:40 +1000
changeset 489577 e2ac39e3e6b7d3960570e13f6d7866477393f6b1
parent 489576 8a18c6a79fb95d0bcba8c4ec02c81ef63bcd112a
child 489578 cf8715e6d27c3ffb96278eba968a8a460435f2d4
push id9738
push useraciure@mozilla.com
push dateMon, 03 Sep 2018 16:13:51 +0000
treeherdermozilla-beta@f5841408a66c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1487296
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1487296 - Merge nsISHistoryInternal into nsISHistory. r=nika With legacy add-ons gone, there is no benefit to keeping them separate.
docshell/base/nsDocShell.cpp
docshell/shistory/ChildSHistory.cpp
docshell/shistory/ChildSHistory.h
docshell/shistory/moz.build
docshell/shistory/nsISHistory.idl
docshell/shistory/nsISHistoryInternal.idl
docshell/shistory/nsSHEntryShared.cpp
docshell/shistory/nsSHistory.cpp
docshell/shistory/nsSHistory.h
docshell/test/browser/browser_bug422543.js
docshell/test/browser/file_bug422543_script.js
docshell/test/navigation/file_bug1326251_evict_cache.html
dom/base/nsFrameLoader.cpp
dom/base/nsHistory.cpp
layout/base/nsDocumentViewer.cpp
toolkit/actors/PurgeSessionHistoryChild.jsm
toolkit/components/viewsource/content/viewSource-content.js
toolkit/modules/sessionstore/SessionHistory.jsm
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -114,17 +114,16 @@
 #include "nsIScrollableFrame.h"
 #include "nsIScrollObserver.h"
 #include "nsISecureBrowserUI.h"
 #include "nsISecurityUITelemetry.h"
 #include "nsISeekableStream.h"
 #include "nsISelectionDisplay.h"
 #include "nsISHEntry.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "nsISiteSecurityService.h"
 #include "nsISocketProvider.h"
 #include "nsIStringBundle.h"
 #include "nsIStructuredCloneContainer.h"
 #include "nsISupportsPrimitives.h"
 #include "nsITabChild.h"
 #include "nsITextToSubURI.h"
 #include "nsITimedChannel.h"
@@ -418,17 +417,17 @@ nsDocShell::~nsDocShell()
   MOZ_ASSERT(!mObserved);
 
   // Avoid notifying observers while we're in the dtor.
   mIsBeingDestroyed = true;
 
   Destroy();
 
   if (mSessionHistory) {
-    mSessionHistory->LegacySHistoryInternal()->SetRootDocShell(nullptr);
+    mSessionHistory->LegacySHistory()->SetRootDocShell(nullptr);
   }
 
   if (--gDocShellCount == 0) {
     NS_IF_RELEASE(sURIFixup);
   }
 
   MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p destroyed\n", this));
 
@@ -1065,17 +1064,17 @@ nsDocShell::FirePageHideNotificationInte
       }
     }
 
     // If the document is unloading, remove all dynamic subframe entries.
     if (aIsUnload && !aSkipCheckingDynEntries) {
       RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
       if (rootSH && mOSHE) {
         int32_t index = rootSH->Index();
-        rootSH->LegacySHistoryInternal()->RemoveDynEntries(index, mOSHE);
+        rootSH->LegacySHistory()->RemoveDynEntries(index, mOSHE);
       }
     }
 
     // Now make sure our editor, if any, is detached before we go
     // any farther.
     DetachEditorFromWindow();
   }
 }
@@ -3792,17 +3791,17 @@ nsDocShell::AddChildSHEntryInternal(nsIS
     if (currentEntry) {
       uint32_t cloneID = 0;
       nsCOMPtr<nsISHEntry> nextEntry;
       aCloneRef->GetID(&cloneID);
       rv = nsSHistory::CloneAndReplace(currentEntry, this, cloneID,
         aNewEntry, aCloneChildren, getter_AddRefs(nextEntry));
 
       if (NS_SUCCEEDED(rv)) {
-        rv = mSessionHistory->LegacySHistoryInternal()->AddEntry(nextEntry, true);
+        rv = mSessionHistory->LegacySHistory()->AddEntry(nextEntry, true);
       }
     }
   } else {
     /* Just pass this along */
     nsCOMPtr<nsIDocShell> parent =
       do_QueryInterface(GetAsSupports(mParent), &rv);
     if (parent) {
       rv = static_cast<nsDocShell*>(parent.get())->AddChildSHEntryInternal(
@@ -3877,17 +3876,17 @@ nsDocShell::RemoveFromSessionHistory()
     return NS_OK;
   }
   RefPtr<ChildSHistory> sessionHistory = rootAsWebnav->GetSessionHistory();
   if (!sessionHistory) {
     return NS_OK;
   }
   int32_t index = sessionHistory->Index();
   AutoTArray<nsID, 16> ids({mHistoryID});
-  sessionHistory->LegacySHistoryInternal()->RemoveEntries(ids, index);
+  sessionHistory->LegacySHistory()->RemoveEntries(ids, index);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetCreatedDynamically(bool aDynamic)
 {
   mDynamicallyCreated = aDynamic;
   return NS_OK;
@@ -3999,17 +3998,17 @@ nsDocShell::ClearFrameHistory(nsISHEntry
   for (int32_t i = 0; i < count; ++i) {
     nsCOMPtr<nsISHEntry> child;
     aEntry->GetChildAt(i, getter_AddRefs(child));
     if (child) {
       ids.AppendElement(child->DocshellID());
     }
   }
   int32_t index = rootSH->Index();
-  rootSH->LegacySHistoryInternal()->RemoveEntries(ids, index);
+  rootSH->LegacySHistory()->RemoveEntries(ids, index);
 }
 
 //-------------------------------------
 //-- Helper Method for Print discovery
 //-------------------------------------
 bool
 nsDocShell::IsPrintingOrPP(bool aDisplayErrorDialog)
 {
@@ -4857,17 +4856,17 @@ nsDocShell::Reload(uint32_t aReloadFlags
   uint32_t loadType = MAKE_LOAD_TYPE(LOAD_RELOAD_NORMAL, aReloadFlags);
   NS_ENSURE_TRUE(IsValidLoadType(loadType), NS_ERROR_INVALID_ARG);
 
   // Send notifications to the HistoryListener if any, about the impending
   // reload
   RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
   bool canReload = true;
   if (rootSH) {
-    rootSH->LegacySHistoryInternal()
+    rootSH->LegacySHistory()
       ->NotifyOnHistoryReload(mCurrentURI, aReloadFlags, &canReload);
   }
 
   if (!canReload) {
     return NS_OK;
   }
 
   /* If you change this part of code, make sure bug 45297 does not re-occur */
@@ -8077,17 +8076,17 @@ nsDocShell::RestoreFromHistory()
   // Set mFiredUnloadEvent = false so that the unload handler for the
   // *new* document will fire.
   mFiredUnloadEvent = false;
 
   mURIResultedInDocument = true;
   RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
   if (rootSH) {
     mPreviousTransIndex = rootSH->Index();
-    rootSH->LegacySHistoryInternal()->UpdateIndex();
+    rootSH->LegacySHistory()->UpdateIndex();
     mLoadedTransIndex = rootSH->Index();
 #ifdef DEBUG_PAGE_CACHE
     printf("Previous index: %d, Loaded index: %d\n\n", mPreviousTransIndex,
            mLoadedTransIndex);
 #endif
   }
 
   // Rather than call Embed(), we will retrieve the viewer from the session
@@ -11531,17 +11530,17 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsICh
     mSessionHistory->LegacySHistory()->GetRequestedIndex(&index);
     if (index == -1) {
       index = mSessionHistory->Index();
     }
     nsCOMPtr<nsISHEntry> currentSH;
     mSessionHistory->LegacySHistory()->GetEntryAtIndex(
       index, false, getter_AddRefs(currentSH));
     if (currentSH != mLSHE) {
-      mSessionHistory->LegacySHistoryInternal()->ReplaceEntry(index, mLSHE);
+      mSessionHistory->LegacySHistory()->ReplaceEntry(index, mLSHE);
     }
   }
 
   // If this is a POST request, we do not want to include this in global
   // history.
   if (updateGHistory && aAddToGlobalHistory && !ChannelIsPost(aChannel)) {
     nsCOMPtr<nsIURI> previousURI;
     uint32_t previousFlags = 0;
@@ -11564,17 +11563,17 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsICh
 
   // If this was a history load or a refresh, or it was a history load but
   // later changed to LOAD_NORMAL_REPLACE due to redirection, update the index
   // in session history.
   if (rootSH &&
        ((mLoadType & (LOAD_CMD_HISTORY | LOAD_CMD_RELOAD)) ||
          mLoadType == LOAD_NORMAL_REPLACE)) {
     mPreviousTransIndex = rootSH->Index();
-    rootSH->LegacySHistoryInternal()->UpdateIndex();
+    rootSH->LegacySHistory()->UpdateIndex();
     mLoadedTransIndex = rootSH->Index();
 #ifdef DEBUG_PAGE_CACHE
     printf("Previous index: %d, Loaded index: %d\n\n",
            mPreviousTransIndex, mLoadedTransIndex);
 #endif
   }
 
   // aCloneSHChildren exactly means "we are not loading a new document".
@@ -11876,25 +11875,25 @@ nsDocShell::AddState(JS::Handle<JS::Valu
   // call ReplaceEntry so that we notify nsIHistoryListeners that an entry
   // was replaced.
   RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
   NS_ENSURE_TRUE(rootSH, NS_ERROR_UNEXPECTED);
 
   if (!aReplace) {
     int32_t curIndex = rootSH->Index();
     if (curIndex > -1) {
-      rootSH->LegacySHistoryInternal()->EvictOutOfRangeContentViewers(curIndex);
+      rootSH->LegacySHistory()->EvictOutOfRangeContentViewers(curIndex);
     }
   } else {
     nsCOMPtr<nsISHEntry> rootSHEntry = nsSHistory::GetRootSHEntry(newSHEntry);
 
     int32_t index = -1;
     rv = rootSH->LegacySHistory()->GetIndexOfEntry(rootSHEntry, &index);
     if (NS_SUCCEEDED(rv) && index > -1) {
-      rootSH->LegacySHistoryInternal()->ReplaceEntry(index, rootSHEntry);
+      rootSH->LegacySHistory()->ReplaceEntry(index, rootSHEntry);
     }
   }
 
   // Step 6: If the document's URI changed, update document's URI and update
   // global history.
   //
   // We need to call FireOnLocationChange so that the browser's address bar
   // gets updated and the back button is enabled, but we only need to
@@ -12201,31 +12200,29 @@ nsDocShell::AddToSessionHistory(nsIURI* 
       int32_t index = 0;
       mSessionHistory->LegacySHistory()->GetRequestedIndex(&index);
       if (index == -1) {
         index = mSessionHistory->Index();
       }
 
       // Replace the current entry with the new entry
       if (index >= 0) {
-        rv = mSessionHistory->LegacySHistoryInternal()->ReplaceEntry(index,
-                                                                     entry);
+        rv = mSessionHistory->LegacySHistory()->ReplaceEntry(index, entry);
       } else {
         // If we're trying to replace an inexistant shistory entry, append.
         addToSHistory = true;
       }
     }
 
     if (addToSHistory) {
       // Add to session history
       mPreviousTransIndex = mSessionHistory->Index();
 
       bool shouldPersist = ShouldAddToSessionHistory(aURI, aChannel);
-      rv = mSessionHistory->LegacySHistoryInternal()->AddEntry(
-        entry, shouldPersist);
+      rv = mSessionHistory->LegacySHistory()->AddEntry(entry, shouldPersist);
       mLoadedTransIndex = mSessionHistory->Index();
 #ifdef DEBUG_PAGE_CACHE
       printf("Previous index: %d, Loaded index: %d\n\n",
              mPreviousTransIndex, mLoadedTransIndex);
 #endif
     }
   } else {
     // This is a subframe.
--- a/docshell/shistory/ChildSHistory.cpp
+++ b/docshell/shistory/ChildSHistory.cpp
@@ -84,22 +84,16 @@ ChildSHistory::EvictLocalContentViewers(
 }
 
 nsISHistory*
 ChildSHistory::LegacySHistory()
 {
   return mHistory;
 }
 
-nsISHistoryInternal*
-ChildSHistory::LegacySHistoryInternal()
-{
-  return mHistory;
-}
-
 nsIWebNavigation*
 ChildSHistory::LegacySHistoryWebNav()
 {
   return mHistory;
 }
 
 ParentSHistory*
 ChildSHistory::GetParentIfSameProcess()
--- a/docshell/shistory/ChildSHistory.h
+++ b/docshell/shistory/ChildSHistory.h
@@ -22,17 +22,16 @@
 
 #include "nsCOMPtr.h"
 #include "mozilla/ErrorResult.h"
 #include "nsWrapperCache.h"
 
 class nsSHistory;
 class nsDocShell;
 class nsISHistory;
-class nsISHistoryInternal;
 class nsIWebNavigation;
 class nsIGlobalObject;
 
 namespace mozilla {
 namespace dom {
 
 class ParentSHistory;
 
@@ -67,17 +66,16 @@ public:
   void Go(int32_t aOffset, ErrorResult& aRv);
 
   /**
    * Evicts all content viewers within the current process.
    */
   void EvictLocalContentViewers();
 
   nsISHistory* LegacySHistory();
-  nsISHistoryInternal* LegacySHistoryInternal();
   nsIWebNavigation* LegacySHistoryWebNav();
 
   ParentSHistory* GetParentIfSameProcess();
 
 private:
   virtual ~ChildSHistory();
 
   RefPtr<nsDocShell> mDocShell;
--- a/docshell/shistory/moz.build
+++ b/docshell/shistory/moz.build
@@ -3,17 +3,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPIDL_SOURCES += [
     'nsIBFCacheEntry.idl',
     'nsISHEntry.idl',
     'nsISHistory.idl',
-    'nsISHistoryInternal.idl',
     'nsISHistoryListener.idl',
     'nsISHTransaction.idl',
 ]
 
 XPIDL_MODULE = 'shistory'
 
 EXPORTS += [
     'nsSHEntryShared.h',
--- a/docshell/shistory/nsISHistory.idl
+++ b/docshell/shistory/nsISHistory.idl
@@ -1,17 +1,27 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
+interface nsIBFCacheEntry;
+interface nsIDocShell;
 interface nsISHEntry;
 interface nsISHistoryListener;
+interface nsISHTransaction;
+interface nsIURI;
+
+%{C++
+#include "nsTArrayForwardDeclare.h"
+%}
+
+[ref] native nsDocshellIDArray(nsTArray<nsID>);
 
 /**
  * An interface to the primary properties of the Session History
  * component. In an embedded browser environment, the nsIWebBrowser
  * object creates an instance of session history for each open window.
  * A handle to the session history object can be obtained from
  * nsIWebNavigation. In a non-embedded situation, the  owner of the
  * session history component must create a instance of it and set
@@ -131,9 +141,128 @@ interface nsISHistory: nsISupports
    * @param aEntry            The entry to obtain the index of.
    *
    * @return                  <code>NS_OK</code> index for the history entry
    *                          is obtained successfully.
    *                          <code>NS_ERROR_FAILURE</code> Error in obtaining
    *                          index for the given history entry.
    */
   long getIndexOfEntry(in nsISHEntry aEntry);
+
+  /**
+   * Add a new Entry to the History List.
+   *
+   * @param aEntry            The entry to add.
+   * @param aPersist          If true this specifies that the entry should
+   *                          persist in the list. If false, this means that
+   *                          when new entries are added this element will not
+   *                          appear in the session history list.
+   */
+  void addEntry(in nsISHEntry aEntry, in boolean aPersist);
+
+  /**
+   * Get the transaction at a particular index.
+   */
+  nsISHTransaction GetTransactionAtIndex(in int32_t aIndex);
+
+  /**
+   * Sets the toplevel docshell object to which this SHistory object belongs to.
+   */
+  void setRootDocShell(in nsIDocShell rootDocShell);
+
+  /**
+   * Update the index maintained by sessionHistory
+   */
+  void updateIndex();
+
+  /**
+   * Replace the nsISHEntry at a particular index
+   *
+   * @param aIndex            The index at which the entry should be replaced.
+   * @param aReplaceEntry     The replacement entry for the index.
+   */
+  void replaceEntry(in long aIndex, in nsISHEntry aReplaceEntry);
+
+  /**
+   * Notifies all registered session history listeners about an impending
+   * reload.
+   *
+   * @param aReloadURI        The URI of the document to be reloaded.
+   * @param aReloadFlags      Flags that indicate how the document is to be
+   *                          refreshed. See constants on the nsIWebNavigation
+   *                          interface.
+   *
+   * @return                  Whether the operation can proceed.
+   */
+  boolean notifyOnHistoryReload(in nsIURI aReloadURI,
+                                in unsigned long aReloadFlags);
+
+  /**
+   * Evict content viewers which don't lie in the "safe" range around aIndex.
+   * In practice, this should leave us with no more than gHistoryMaxViewers
+   * viewers associated with this SHistory object.
+   *
+   * Also make sure that the total number of content viewers in all windows is
+   * not greater than our global max; if it is, evict viewers as appropriate.
+   *
+   * @param aIndex           The index around which the "safe" range is
+   *                         centered.  In general, if you just navigated the
+   *                         history, aIndex should be the index history was
+   *                         navigated to.
+   */
+  void evictOutOfRangeContentViewers(in long aIndex);
+
+  /**
+   * Evict the content viewer associated with a bfcache entry that has timed
+   * out.
+   */
+  void evictExpiredContentViewerForEntry(in nsIBFCacheEntry aEntry);
+
+  /**
+   * Evict all the content viewers in this session history
+   */
+  void evictAllContentViewers();
+
+  /**
+   * Add a BFCache entry to expiration tracker so it gets evicted on
+   * expiration.
+   */
+  void addToExpirationTracker(in nsIBFCacheEntry aEntry);
+
+  /**
+   * Remove a BFCache entry from expiration tracker.
+   */
+  void removeFromExpirationTracker(in nsIBFCacheEntry aEntry);
+
+  /**
+   * Remove dynamic entries found at given index.
+   *
+   * @param aIndex           Index to remove dynamic entries from. It will be
+   *                         passed to RemoveEntries as aStartIndex.
+   * @param aEntry (optional)  The entry to start looking in for dynamic
+   *                         entries. Only the dynamic descendants of the
+   *                         entry will be removed. If not given, all dynamic
+   *                         entries at the index will be removed.
+   */
+  [noscript, notxpcom]
+  void RemoveDynEntries(in long aIndex, in nsISHEntry aEntry);
+
+  /**
+   * Similar to RemoveDynEntries, but instead of specifying an index, use the
+   * given BFCacheEntry to find the index and remove dynamic entries from the
+   * index.
+   *
+   * The method takes no effect if the bfcache entry is not or no longer hold
+   * by the SHistory instance.
+   *
+   * @param aEntry           The bfcache entry to look up for index to remove
+   *                         dynamic entries from.
+   */
+  [noscript, notxpcom]
+  void RemoveDynEntriesForBFCacheEntry(in nsIBFCacheEntry aEntry);
+
+  /**
+   * Removes entries from the history if their docshellID is in
+   * aIDs array.
+   */
+  [noscript, notxpcom]
+  void RemoveEntries(in nsDocshellIDArray aIDs, in long aStartIndex);
 };
deleted file mode 100644
--- a/docshell/shistory/nsISHistoryInternal.idl
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIBFCacheEntry;
-interface nsISHEntry;
-interface nsISHistoryListener;
-interface nsISHTransaction;
-interface nsIDocShell;
-interface nsIURI;
-
-%{C++
-#include "nsTArrayForwardDeclare.h"
-%}
-
-[ref] native nsDocshellIDArray(nsTArray<nsID>);
-
-[scriptable, uuid(3dfb2f54-378d-4d3c-a9f9-95dd2673248c)]
-interface nsISHistoryInternal: nsISupports
-{
-  /**
-   * Add a new Entry to the History List
-   * @param aEntry - The entry to add
-   * @param aPersist - If true this specifies that the entry should persist
-   * in the list.  If false, this means that when new entries are added
-   * this element will not appear in the session history list.
-   */
-   void  addEntry(in nsISHEntry aEntry, in boolean aPersist);
-
-  /**
-   * Get the transaction at a particular index.
-   */
-  nsISHTransaction GetTransactionAtIndex(in int32_t aIndex);
-
-  /**
-   * Sets the toplevel docshell object to which this SHistory object belongs to.
-   */
-   void setRootDocShell(in nsIDocShell rootDocShell);
-
-  /**
-   * Update the index maintained by sessionHistory
-   */
-   void updateIndex();
-
-  /**
-   * Replace the nsISHEntry at a particular index
-   * @param aIndex - The index at which the entry should be replaced
-   * @param aReplaceEntry - The replacement entry for the index.
-   */
-   void replaceEntry(in long aIndex, in nsISHEntry aReplaceEntry);
-
-  /**
-   * Notifies all registered session history listeners about an impending
-   * reload.
-   *
-   * @param aReloadURI    The URI of the document to be reloaded.
-   * @param aReloadFlags  Flags that indicate how the document is to be
-   *                      refreshed. See constants on the nsIWebNavigation
-   *                      interface.
-   * @return              Whether the operation can proceed.
-   */
-   boolean notifyOnHistoryReload(in nsIURI aReloadURI, in unsigned long aReloadFlags);
-
-   /**
-    * Evict content viewers which don't lie in the "safe" range around aIndex.
-    * In practice, this should leave us with no more than gHistoryMaxViewers
-    * viewers associated with this SHistory object.
-    *
-    * Also make sure that the total number of content viewers in all windows is
-    * not greater than our global max; if it is, evict viewers as appropriate.
-    *
-    * @param aIndex - The index around which the "safe" range is centered.  In
-    *   general, if you just navigated the history, aIndex should be the index
-    *   history was navigated to.
-    */
-   void evictOutOfRangeContentViewers(in long aIndex);
-
-   /**
-    * Evict the content viewer associated with a bfcache entry
-    * that has timed out.
-    */
-   void evictExpiredContentViewerForEntry(in nsIBFCacheEntry aEntry);
-
-   /**
-    * Evict all the content viewers in this session history
-    */
-   void evictAllContentViewers();
-
-   /**
-    * Add a BFCache entry to expiration tracker so it gets evicted on expiration.
-    */
-   void addToExpirationTracker(in nsIBFCacheEntry aEntry);
-
-   /**
-    * Remove a BFCache entry from expiration tracker.
-    */
-   void removeFromExpirationTracker(in nsIBFCacheEntry aEntry);
-
-   /**
-    * Remove dynamic entries found at given index.
-    *
-    * @param aIndex
-    *        Index to remove dynamic entries from. It will be passed to
-    *        RemoveEntries as aStartIndex.
-    * @param aEntry (optional)
-    *        The entry to start looking in for dynamic entries. Only the
-    *        dynamic descendants of the entry will be removed. If not given,
-    *        all dynamic entries at the index will be removed.
-    */
-   [noscript, notxpcom] void RemoveDynEntries(in long aIndex,
-                                              in nsISHEntry aEntry);
-
-   /**
-    * Similar to RemoveDynEntries, but instead of specifying an index, use the
-    * given BFCacheEntry to find the index and remove dynamic entries from the
-    * index.
-    *
-    * The method takes no effect if the bfcache entry is not or no longer hold
-    * by the SHistory instance.
-    *
-    * @param aEntry
-    *        The bfcache entry to look up for index to remove dynamic entries
-    *        from.
-    */
-   [noscript, notxpcom] void RemoveDynEntriesForBFCacheEntry(in nsIBFCacheEntry aEntry);
-
-   /**
-    * Removes entries from the history if their docshellID is in
-    * aIDs array.
-    */
-   [noscript, notxpcom] void RemoveEntries(in nsDocshellIDArray aIDs,
-                                           in long aStartIndex);
-};
--- a/docshell/shistory/nsSHEntryShared.cpp
+++ b/docshell/shistory/nsSHEntryShared.cpp
@@ -9,17 +9,16 @@
 #include "nsArray.h"
 #include "nsDocShellEditorData.h"
 #include "nsIContentViewer.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocument.h"
 #include "nsILayoutHistoryState.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "nsIWebNavigation.h"
 #include "nsThreadUtils.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Preferences.h"
 
 namespace dom = mozilla::dom;
 
@@ -87,17 +86,17 @@ nsSHEntryShared::Duplicate(nsSHEntryShar
   newEntry->mLastTouched = aEntry->mLastTouched;
 
   return newEntry.forget();
 }
 
 void
 nsSHEntryShared::RemoveFromExpirationTracker()
 {
-  nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(mSHistory);
+  nsCOMPtr<nsISHistory> shistory = do_QueryReferent(mSHistory);
   if (shistory && GetExpirationState()->IsTracked()) {
     shistory->RemoveFromExpirationTracker(this);
   }
 }
 
 nsresult
 nsSHEntryShared::SyncPresentationState()
 {
@@ -150,17 +149,17 @@ nsSHEntryShared::SetContentViewer(nsICon
   // non-null content viewer, the entry shouldn't have been tracked either.
   MOZ_ASSERT(!GetExpirationState()->IsTracked());
   mContentViewer = aViewer;
 
   if (mContentViewer) {
     // mSHistory is only set for root entries, but in general bfcache only
     // applies to root entries as well. BFCache for subframe navigation has been
     // disabled since 2005 in bug 304860.
-    if (nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(mSHistory)) {
+    if (nsCOMPtr<nsISHistory> shistory = do_QueryReferent(mSHistory)) {
       shistory->AddToExpirationTracker(this);
     }
 
     // Store observed document in strong pointer in case it is removed from
     // the contentviewer
     mDocument = mContentViewer->GetDocument();
     if (mDocument) {
       mDocument->SetBFCacheEntry(this);
@@ -185,17 +184,17 @@ nsSHEntryShared::RemoveFromBFCacheSync()
   DropPresentationState();
 
   if (viewer) {
     viewer->Destroy();
   }
 
   // Now that we've dropped the viewer, we have to clear associated dynamic
   // subframe entries.
-  nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(mSHistory);
+  nsCOMPtr<nsISHistory> shistory = do_QueryReferent(mSHistory);
   if (shistory) {
     shistory->RemoveDynEntriesForBFCacheEntry(this);
   }
 
   return NS_OK;
 }
 
 nsresult
@@ -216,17 +215,17 @@ nsSHEntryShared::RemoveFromBFCacheAsync(
   RefPtr<nsSHEntryShared> self = this;
   nsresult rv = mDocument->Dispatch(mozilla::TaskCategory::Other,
     NS_NewRunnableFunction("nsSHEntryShared::RemoveFromBFCacheAsync",
     [self, viewer, document]() {
       if (viewer) {
         viewer->Destroy();
       }
 
-      nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(self->mSHistory);
+      nsCOMPtr<nsISHistory> shistory = do_QueryReferent(self->mSHistory);
       if (shistory) {
         shistory->RemoveDynEntriesForBFCacheEntry(self);
       }
     }));
 
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to dispatch RemoveFromBFCacheAsync runnable.");
   } else {
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -251,17 +251,16 @@ nsSHistory::~nsSHistory()
 
 NS_IMPL_ADDREF(nsSHistory)
 NS_IMPL_RELEASE(nsSHistory)
 
 NS_INTERFACE_MAP_BEGIN(nsSHistory)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISHistory)
   NS_INTERFACE_MAP_ENTRY(nsISHistory)
   NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
-  NS_INTERFACE_MAP_ENTRY(nsISHistoryInternal)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 // static
 uint32_t
 nsSHistory::CalcMaxTotalViewers()
 {
   // This value allows tweaking how fast the allowed amount of content viewers
--- a/docshell/shistory/nsSHistory.h
+++ b/docshell/shistory/nsSHistory.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsSHistory_h
 #define nsSHistory_h
 
 #include "nsCOMPtr.h"
 #include "nsExpirationTracker.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "nsIWebNavigation.h"
 #include "nsSHEntryShared.h"
 #include "nsSimpleEnumerator.h"
 #include "nsTObserverArray.h"
 #include "nsWeakReference.h"
 
 #include "mozilla/LinkedList.h"
 #include "mozilla/UniquePtr.h"
@@ -23,17 +22,16 @@
 class nsIDocShell;
 class nsDocShell;
 class nsSHistoryObserver;
 class nsISHEntry;
 class nsISHTransaction;
 
 class nsSHistory final : public mozilla::LinkedListElement<nsSHistory>,
                          public nsISHistory,
-                         public nsISHistoryInternal,
                          public nsIWebNavigation,
                          public nsSupportsWeakReference
 {
 public:
 
   // The timer based history tracker is used to evict bfcache on expiration.
   class HistoryTracker final : public nsExpirationTracker<nsSHEntryShared, 3>
   {
@@ -67,17 +65,16 @@ public:
     nsISHEntry* destTreeRoot;    // constant; the root of the dest tree
     nsISHEntry* destTreeParent;  // constant; the node under destTreeRoot
                                  // whose children will correspond to aEntry
   };
 
   nsSHistory();
   NS_DECL_ISUPPORTS
   NS_DECL_NSISHISTORY
-  NS_DECL_NSISHISTORYINTERNAL
   NS_DECL_NSIWEBNAVIGATION
 
   // One time initialization method called upon docshell module construction
   static nsresult Startup();
   static void Shutdown();
   static void UpdatePrefs();
 
   // Max number of total cached content viewers.  If the pref
--- a/docshell/test/browser/browser_bug422543.js
+++ b/docshell/test/browser/browser_bug422543.js
@@ -21,17 +21,17 @@ add_task(async function runTests() {
   await checkListeners("gotoindex", "forward to the second shentry");
 
   await whenPageShown(browser, () => browser.reload());
   await checkListeners("reload", "current shentry reloaded");
 
   await whenPageShown(browser, () => browser.gotoIndex(0));
   await checkListeners("gotoindex", "back to the first index");
 
-  // Check nsISHistoryInternal.notifyOnHistoryReload
+  // Check nsISHistory.notifyOnHistoryReload
   info("# part 2");
   ok((await notifyReload()), "reloading has not been canceled");
   await checkListeners("reload", "saw the reload notification");
 
   // Let the first listener cancel the reload action.
   info("# part 3");
   await resetListeners();
   await setListenerRetval(0, false);
--- a/docshell/test/browser/file_bug422543_script.js
+++ b/docshell/test/browser/file_bug422543_script.js
@@ -71,19 +71,19 @@ let testAPI = {
     for (let listener of this.listeners) {
       listener.last = "initial";
     }
 
     sendAsyncMessage("bug422543:resetListeners:return", {});
   },
 
   notifyReload() {
-    let internal = this.shistory.legacySHistory.QueryInterface(Ci.nsISHistoryInternal);
+    let history = this.shistory.legacySHistory;
     let rval =
-      internal.notifyOnHistoryReload(content.document.documentURIObject, 0);
+      history.notifyOnHistoryReload(content.document.documentURIObject, 0);
     sendAsyncMessage("bug422543:notifyReload:return", { rval });
   },
 
   setRetval({ num, val }) {
     this.listeners[num].retval = val;
     sendAsyncMessage("bug422543:setRetval:return", {});
   },
 };
--- a/docshell/test/navigation/file_bug1326251_evict_cache.html
+++ b/docshell/test/navigation/file_bug1326251_evict_cache.html
@@ -7,17 +7,16 @@
     SpecialPowers.Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 
     // Evict bfcache and then go back.
     async function evictCache() {
       let shistory = SpecialPowers.wrap(window)
                        .docShell
                        .QueryInterface(SpecialPowers.Ci.nsIWebNavigation)
                        .sessionHistory;
-      let shPrivate = shistory.legacySHistory.QueryInterface(SpecialPowers.Ci.nsISHistoryInternal);
-      shPrivate.evictAllContentViewers();
+      shistory.legacySHistory.evictAllContentViewers();
       history.back();
     }
     </script>
   </head>
   <body onload="setTimeout(evictCache, 0);">
   </body>
 </html>
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -35,17 +35,16 @@
 #include "nsIScriptSecurityManager.h"
 #include "nsIScrollable.h"
 #include "nsFrameLoader.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsSubDocumentFrame.h"
 #include "nsError.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "nsIXULWindow.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsISHistory.h"
 #include "nsIScriptError.h"
 #include "nsGlobalWindow.h"
 #include "nsHTMLDocument.h"
 #include "nsPIWindowRoot.h"
 #include "nsLayoutUtils.h"
--- a/dom/base/nsHistory.cpp
+++ b/dom/base/nsHistory.cpp
@@ -14,17 +14,16 @@
 #include "nsPresContext.h"
 #include "nsIDocShell.h"
 #include "nsIWebNavigation.h"
 #include "nsIURI.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsReadableUtils.h"
 #include "nsContentUtils.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "mozilla/Preferences.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //
 //  History class implementation
 //
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -105,17 +105,16 @@
 
 //focus
 #include "nsIDOMEventListener.h"
 #include "nsISelectionController.h"
 
 #include "mozilla/EventDispatcher.h"
 #include "nsISHEntry.h"
 #include "nsISHistory.h"
-#include "nsISHistoryInternal.h"
 #include "nsIWebNavigation.h"
 #include "mozilla/dom/XMLHttpRequestMainThread.h"
 
 //paint forcing
 #include <stdio.h>
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
@@ -2249,18 +2248,17 @@ nsDocumentViewer::Show(void)
         int32_t prevIndex,loadedIndex;
         nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(treeItem);
         docShell->GetPreviousTransIndex(&prevIndex);
         docShell->GetLoadedTransIndex(&loadedIndex);
 #ifdef DEBUG_PAGE_CACHE
         printf("About to evict content viewers: prev=%d, loaded=%d\n",
                prevIndex, loadedIndex);
 #endif
-        history->LegacySHistoryInternal()->
-          EvictOutOfRangeContentViewers(loadedIndex);
+        history->LegacySHistory()->EvictOutOfRangeContentViewers(loadedIndex);
       }
     }
   }
 
   if (mWindow) {
     // When attached to a top level xul window, we do not need to call
     // Show on the widget. Underlying window management code handles
     // this when the window is initialized.
--- a/toolkit/actors/PurgeSessionHistoryChild.jsm
+++ b/toolkit/actors/PurgeSessionHistoryChild.jsm
@@ -16,17 +16,16 @@ class PurgeSessionHistoryChild extends A
     let sessionHistory = this.docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
     if (!sessionHistory) {
       return;
     }
 
     // place the entry at current index at the end of the history list, so it won't get removed
     if (sessionHistory.index < sessionHistory.count - 1) {
       let legacy = sessionHistory.legacySHistory;
-      legacy.QueryInterface(Ci.nsISHistoryInternal);
       let indexEntry = legacy.getEntryAtIndex(sessionHistory.index, false);
       indexEntry.QueryInterface(Ci.nsISHEntry);
       legacy.addEntry(indexEntry, true);
     }
 
     let purge = sessionHistory.count;
     if (this.content.location.href != "about:blank") {
       --purge; // Don't remove the page the user's staring at from shistory
--- a/toolkit/components/viewsource/content/viewSource-content.js
+++ b/toolkit/components/viewsource/content/viewSource-content.js
@@ -264,17 +264,16 @@ var ViewSourceContent = {
     shEntry.setTitle(viewSrcURL);
     let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
     shEntry.triggeringPrincipal = systemPrincipal;
     shEntry.setAsHistoryLoad();
     shEntry.cacheKey = shEntrySource.cacheKey;
     docShell.QueryInterface(Ci.nsIWebNavigation)
             .sessionHistory
             .legacySHistory
-            .QueryInterface(Ci.nsISHistoryInternal)
             .addEntry(shEntry, true);
   },
 
   /**
    * Load some URL in the browser.
    *
    * @param URL
    *        The URL string to load.
--- a/toolkit/modules/sessionstore/SessionHistory.jsm
+++ b/toolkit/modules/sessionstore/SessionHistory.jsm
@@ -79,20 +79,19 @@ var SessionHistoryInternal = {
     // how many we skipped, so we can sanitiy-check the current history index
     // and also determine whether we need to get any fallback data or not.
     let skippedCount = 0, entryCount = 0;
 
     if (history && history.count > 0) {
       // Loop over the transactions so we can get the persist property for each
       // one.
       let shistory = history.legacySHistory.QueryInterface(Ci.nsISHistory);
-      let shistoryInternal = history.legacySHistory.QueryInterface(Ci.nsISHistoryInternal);
       let count = shistory.count;
       for ( ; entryCount < count; entryCount++) {
-        let txn = shistoryInternal.GetTransactionAtIndex(entryCount);
+        let txn = shistory.GetTransactionAtIndex(entryCount);
         if (entryCount <= aFromIdx) {
           skippedCount++;
           continue;
         }
         let entry = this.serializeEntry(txn.sHEntry);
         entry.persist = txn.persist;
         data.entries.push(entry);
       }
@@ -288,25 +287,24 @@ var SessionHistoryInternal = {
 
   /**
    * Restores session history data for a given docShell.
    *
    * @param docShell
    *        The docShell that owns the session history.
    * @param tabData
    *        The tabdata including all history entries.
-   * @return A reference to the docShell's nsISHistoryInternal interface.
+   * @return A reference to the docShell's nsISHistory interface.
    */
   restore(docShell, tabData) {
     let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
     let history = webNavigation.sessionHistory.legacySHistory;
     if (history.count > 0) {
       history.PurgeHistory(history.count);
     }
-    history.QueryInterface(Ci.nsISHistoryInternal);
 
     let idMap = { used: {} };
     let docIdentMap = {};
     for (let i = 0; i < tabData.entries.length; i++) {
       let entry = tabData.entries[i];
       // XXXzpao Wallpaper patch for bug 514751
       if (!entry.url)
         continue;