Bug 1490158 Remove On{Length,Index}Changed from nsISHistoryListener. r=nika
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 07 Sep 2018 10:27:05 +1000
changeset 491585 a7e6396a117fbfb62da7590121c6486384af48bc
parent 491584 5292dc5332d6cd06030de412fab14527d4071e43
child 491586 780ffc5018c43fa995a1aed1d723152e9ce0474b
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1490158
milestone64.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 1490158 Remove On{Length,Index}Changed from nsISHistoryListener. r=nika They're never used.
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/ContentSessionStore.jsm
docshell/shistory/nsISHistoryListener.idl
docshell/shistory/nsSHistory.cpp
mobile/android/chrome/content/browser.js
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -412,24 +412,16 @@ HistoryListener.prototype = {
   },
 
   OnHistoryReload(reloadURI, reloadFlags) {
     this.callback();
 
     // Cancel the load.
     return false;
   },
-
-  OnLengthChanged(aCount) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  },
-
-  OnIndexChanged(aIndex) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  },
 };
 
 /**
  * This class informs SessionStore.jsm whenever the network requests for a
  * restoring page have completely finished. We only restore three tabs
  * simultaneously, so this is the signal for SessionStore.jsm to kick off
  * another restore (if there are more to do).
  *
--- a/browser/components/sessionstore/ContentSessionStore.jsm
+++ b/browser/components/sessionstore/ContentSessionStore.jsm
@@ -310,24 +310,16 @@ class SessionHistoryListener extends Han
   OnHistoryReload(reloadURI, reloadFlags) {
     this.collect();
     return true;
   }
 
   OnHistoryReplaceEntry(index) {
     this.collect();
   }
-
-  OnLengthChanged(aCount) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  }
-
-  OnIndexChanged(aIndex) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  }
 }
 SessionHistoryListener.prototype.QueryInterface =
   ChromeUtils.generateQI([Ci.nsISHistoryListener,
                           Ci.nsISupportsWeakReference]);
 
 /**
  * Listens for scroll position changes. Whenever the user scrolls the top-most
  * frame we update the scroll position and will restore it when requested.
--- a/docshell/shistory/nsISHistoryListener.idl
+++ b/docshell/shistory/nsISHistoryListener.idl
@@ -78,19 +78,9 @@ interface nsISHistoryListener : nsISuppo
    * Called before an entry is replaced in the session history. Entries are
    * replaced when navigating away from non-persistent history entries (such as
    * about pages) and when history.replaceState is called.
    *
    * @param aIndex        The index in session history of the entry being
    *                      replaced.
    */
   void OnHistoryReplaceEntry(in long aIndex);
-
-   /**
-    * Called after nsISHistory::count has been updated.
-    */
-  void OnLengthChanged(in long aCount);
-
-  /**
-   * Called after nsISHistory::index has been updated.
-   */
-  void OnIndexChanged(in long aIndex);
 };
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -636,19 +636,16 @@ nsSHistory::AddEntry(nsISHEntry* aSHEntr
   // Remove all entries after the current one, add the new one, and set the new
   // one as the current one.
   MOZ_ASSERT(mIndex >= -1);
   aSHEntry->SetPersist(aPersist);
   mEntries.TruncateLength(mIndex + 1);
   mEntries.AppendElement(aSHEntry);
   mIndex++;
 
-  NOTIFY_LISTENERS(OnLengthChanged, (Length()));
-  NOTIFY_LISTENERS(OnIndexChanged, (mIndex));
-
   // Purge History list if it is too long
   if (gHistoryMaxSize >= 0 && Length() > gHistoryMaxSize) {
     PurgeHistory(Length() - gHistoryMaxSize);
   }
 
   return NS_OK;
 }
 
@@ -672,18 +669,16 @@ nsSHistory::GetIndex(int32_t* aResult)
 NS_IMETHODIMP
 nsSHistory::SetIndex(int32_t aIndex)
 {
   if (aIndex < 0 || aIndex >= Length()) {
     return NS_ERROR_FAILURE;
   }
 
   mIndex = aIndex;
-  NOTIFY_LISTENERS(OnIndexChanged, (mIndex))
-
   return NS_OK;
 }
 
 /* Get the requestedIndex */
 NS_IMETHODIMP
 nsSHistory::GetRequestedIndex(int32_t* aResult)
 {
   MOZ_ASSERT(aResult, "null out param?");
@@ -802,19 +797,16 @@ nsSHistory::PurgeHistory(int32_t aNumEnt
   mEntries.RemoveElementsAt(0, aNumEntries);
 
   // Adjust the indices, but don't let them go below -1.
   mIndex -= aNumEntries;
   mIndex = std::max(mIndex, -1);
   mRequestedIndex -= aNumEntries;
   mRequestedIndex = std::max(mRequestedIndex, -1);
 
-  NOTIFY_LISTENERS(OnLengthChanged, (Length()));
-  NOTIFY_LISTENERS(OnIndexChanged, (mIndex))
-
   if (mRootDocShell) {
     mRootDocShell->HistoryPurged(aNumEntries);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1351,17 +1343,16 @@ nsSHistory::RemoveDuplicate(int32_t aInd
 
     if (mRootDocShell) {
       static_cast<nsDocShell*>(mRootDocShell)->HistoryEntryRemoved(aIndex);
     }
 
     // Adjust our indices to reflect the removed entry.
     if (mIndex > aIndex) {
       mIndex = mIndex - 1;
-      NOTIFY_LISTENERS(OnIndexChanged, (mIndex));
     }
 
     // NB: If the entry we are removing is the entry currently
     // being navigated to (mRequestedIndex) then we adjust the index
     // only if we're not keeping the next entry (because if we are keeping
     // the next entry (because the current is a duplicate of the next), then
     // that entry slides into the spot that we're currently pointing to.
     // We don't do this adjustment for mIndex because mIndex cannot equal
@@ -1369,17 +1360,16 @@ nsSHistory::RemoveDuplicate(int32_t aInd
 
     // NB: We don't need to guard on mRequestedIndex being nonzero here,
     // because either they're strictly greater than aIndex which is at least
     // zero, or they are equal to aIndex in which case aKeepNext must be true
     // if aIndex is zero.
     if (mRequestedIndex > aIndex || (mRequestedIndex == aIndex && !aKeepNext)) {
       mRequestedIndex = mRequestedIndex - 1;
     }
-    NOTIFY_LISTENERS(OnLengthChanged, (Length()));
     return true;
   }
   return false;
 }
 
 NS_IMETHODIMP_(void)
 nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex)
 {
@@ -1434,17 +1424,16 @@ nsSHistory::RemoveDynEntriesForBFCacheEn
 }
 
 NS_IMETHODIMP
 nsSHistory::UpdateIndex()
 {
   // Update the actual index with the right value.
   if (mIndex != mRequestedIndex && mRequestedIndex != -1) {
     mIndex = mRequestedIndex;
-    NOTIFY_LISTENERS(OnIndexChanged, (mIndex))
   }
 
   mRequestedIndex = -1;
   return NS_OK;
 }
 
 nsresult
 nsSHistory::GetCurrentURI(nsIURI** aResultURI)
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4682,24 +4682,16 @@ Tab.prototype = {
   OnHistoryPurge: function(numEntries) {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
   OnHistoryReplaceEntry: function(index) {
     Services.obs.notifyObservers(this.browser, "Content:HistoryChange");
   },
 
-  OnLengthChanged: function(aCount) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  },
-
-  OnIndexChanged: function(aIndex) {
-    // Ignore, the method is implemented so that XPConnect doesn't throw!
-  },
-
   UpdateMediaPlaybackRelatedObserver: function(active) {
     // Media control is only used for the tab which has playing media, so we
     // only need to register observer after having the active media. And the
     // "media-playback-resumed" is sent when user resume paused media from
     // page, it notifies us that we should change the icon and content in media
     // control interface.
     if (active) {
       Services.obs.addObserver(this, "mediaControl", false);