Bug 944694 - Part 1: Use globally unique UUIDs for docshellID, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Wed, 16 Nov 2016 16:42:35 -0500
changeset 368198 048cb0a9f401b13f4787c77d5d5117938762f018
parent 368197 3891a7e1ba76804e173e112a6f024ff7254e3444
child 368199 66686afdff45b44fe457b1d78c8a963f169a5a0e
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs944694
milestone53.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 944694 - Part 1: Use globally unique UUIDs for docshellID, r=smaug MozReview-Commit-ID: DVLMijTkYKh
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsIDocShell.idl
docshell/shistory/nsISHEntry.idl
docshell/shistory/nsISHistoryInternal.idl
docshell/shistory/nsSHEntry.cpp
docshell/shistory/nsSHEntryShared.cpp
docshell/shistory/nsSHEntryShared.h
docshell/shistory/nsSHistory.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -745,18 +745,16 @@ DecreasePrivateDocShellCount()
 
     nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService();
     if (obsvc) {
       obsvc->NotifyObservers(nullptr, "last-pb-context-exited", nullptr);
     }
   }
 }
 
-static uint64_t gDocshellIDCounter = 0;
-
 nsDocShell::nsDocShell()
   : nsDocLoader()
   , mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto)
   , mTreeOwner(nullptr)
   , mChromeEventHandler(nullptr)
   , mCharsetReloadState(eCharsetReloadInit)
   , mChildOffset(0)
   , mBusyFlags(BUSY_FLAGS_NONE)
@@ -815,35 +813,37 @@ nsDocShell::nsDocShell()
   , mDefaultLoadFlags(nsIRequest::LOAD_NORMAL)
   , mFrameType(FRAME_TYPE_REGULAR)
   , mPrivateBrowsingId(0)
   , mParentCharsetSource(0)
   , mJSRunToCompletionDepth(0)
   , mTouchEventsOverride(nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE)
 {
   AssertOriginAttributesMatchPrivateBrowsing();
-  mHistoryID = ++gDocshellIDCounter;
+
+  nsContentUtils::GenerateUUIDInPlace(mHistoryID);
+
   if (gDocShellCount++ == 0) {
     NS_ASSERTION(sURIFixup == nullptr,
                  "Huh, sURIFixup not null in first nsDocShell ctor!");
 
     CallGetService(NS_URIFIXUP_CONTRACTID, &sURIFixup);
   }
 
   MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
 
 #ifdef DEBUG
   // We're counting the number of |nsDocShells| to help find leaks
   ++gNumberOfDocShells;
   if (!PR_GetEnv("MOZ_QUIET")) {
-    printf_stderr("++DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
+    printf_stderr("++DOCSHELL %p == %ld [pid = %d] [id = %s]\n",
                   (void*)this,
                   gNumberOfDocShells,
                   getpid(),
-                  AssertedCast<unsigned long long>(mHistoryID));
+                  nsIDToCString(mHistoryID).get());
   }
 #endif
 }
 
 nsDocShell::~nsDocShell()
 {
   MOZ_ASSERT(!mObserved);
 
@@ -861,21 +861,21 @@ nsDocShell::~nsDocShell()
   if (gDocShellLeakLog) {
     MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p destroyed\n", this));
   }
 
 #ifdef DEBUG
   // We're counting the number of |nsDocShells| to help find leaks
   --gNumberOfDocShells;
   if (!PR_GetEnv("MOZ_QUIET")) {
-    printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
+    printf_stderr("--DOCSHELL %p == %ld [pid = %d] [id = %s]\n",
                   (void*)this,
                   gNumberOfDocShells,
                   getpid(),
-                  AssertedCast<unsigned long long>(mHistoryID));
+                  nsIDToCString(mHistoryID).get());
   }
 #endif
 }
 
 nsresult
 nsDocShell::Init()
 {
   nsresult rv = nsDocLoader::Init();
@@ -4032,20 +4032,26 @@ nsDocShell::SetTreeOwner(nsIDocShellTree
 NS_IMETHODIMP
 nsDocShell::SetChildOffset(uint32_t aChildOffset)
 {
   mChildOffset = aChildOffset;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShell::GetHistoryID(uint64_t* aID)
-{
-  *aID = mHistoryID;
-  return NS_OK;
+nsDocShell::GetHistoryID(nsID** aID)
+{
+  *aID = static_cast<nsID*>(nsMemory::Clone(&mHistoryID, sizeof(nsID)));
+  return NS_OK;
+}
+
+const nsID
+nsDocShell::HistoryID()
+{
+  return mHistoryID;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetIsInUnload(bool* aIsInUnload)
 {
   *aIsInUnload = mFiredUnloadEvent;
   return NS_OK;
 }
@@ -4489,17 +4495,17 @@ nsDocShell::RemoveFromSessionHistory()
     }
   }
   if (!internalHistory) {
     return NS_OK;
   }
 
   int32_t index = 0;
   sessionHistory->GetIndex(&index);
-  AutoTArray<uint64_t, 16> ids({mHistoryID});
+  AutoTArray<nsID, 16> ids({mHistoryID});
   internalHistory->RemoveEntries(ids, index);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::SetCreatedDynamically(bool aDynamic)
 {
   mDynamicallyCreated = aDynamic;
@@ -4579,24 +4585,22 @@ nsDocShell::ClearFrameHistory(nsISHEntry
   GetRootSessionHistory(getter_AddRefs(rootSH));
   nsCOMPtr<nsISHistoryInternal> history = do_QueryInterface(rootSH);
   if (!history || !shcontainer) {
     return;
   }
 
   int32_t count = 0;
   shcontainer->GetChildCount(&count);
-  AutoTArray<uint64_t, 16> ids;
+  AutoTArray<nsID, 16> ids;
   for (int32_t i = 0; i < count; ++i) {
     nsCOMPtr<nsISHEntry> child;
     shcontainer->GetChildAt(i, getter_AddRefs(child));
     if (child) {
-      uint64_t id = 0;
-      child->GetDocshellID(&id);
-      ids.AppendElement(id);
+      ids.AppendElement(child->DocshellID());
     }
   }
   int32_t index = 0;
   rootSH->GetIndex(&index);
   history->RemoveEntries(ids, index);
 }
 
 //-------------------------------------
@@ -10603,17 +10607,17 @@ nsDocShell::InternalLoad(nsIURI* aURI,
   }
 
   mSavingOldViewer = savePresentation;
 
   // If we have a saved content viewer in history, restore and show it now.
   if (aSHEntry && (mLoadType & LOAD_CMD_HISTORY)) {
     // Make sure our history ID points to the same ID as
     // SHEntry's docshell ID.
-    aSHEntry->GetDocshellID(&mHistoryID);
+    mHistoryID = aSHEntry->DocshellID();
 
     // It's possible that the previous viewer of mContentViewer is the
     // viewer that will end up in aSHEntry when it gets closed.  If that's
     // the case, we need to go ahead and force it into its shentry so we
     // can restore it.
     if (mContentViewer) {
       nsCOMPtr<nsIContentViewer> prevViewer;
       mContentViewer->GetPreviousViewer(getter_AddRefs(prevViewer));
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -993,17 +993,17 @@ protected:
 
   // The following two fields cannot be declared as bit fields
   // because of uses with AutoRestore.
   bool mCreatingDocument; // (should be) debugging only
 #ifdef DEBUG
   bool mInEnsureScriptEnv;
 #endif
 
-  uint64_t mHistoryID;
+  nsID mHistoryID;
   uint32_t mDefaultLoadFlags;
 
   static nsIURIFixup* sURIFixup;
 
   RefPtr<nsDOMNavigationTiming> mTiming;
 
   // Are we a regular frame, a browser frame, or an app frame?
   uint32_t mFrameType;
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -673,17 +673,22 @@ interface nsIDocShell : nsIDocShellTreeI
   /**
    * Whether this docshell is in prerender mode.
    */
   [infallible] readonly attribute boolean isPrerendered;
 
   /**
    * The ID of the docshell in the session history.
    */
-  readonly attribute unsigned long long historyID;
+  readonly attribute nsIDPtr historyID;
+
+  /**
+   * Helper method for accessing this value from C++
+   */
+  [noscript, notxpcom] nsID HistoryID();
 
   /**
    * Sets whether a docshell is an app tab. An app tab docshell may behave
    * differently than a non-app tab docshell in some cases, such as when
    * handling link clicks. Docshells are not app tabs unless told otherwise.
    */
   attribute boolean isAppTab;
 
--- a/docshell/shistory/nsISHEntry.idl
+++ b/docshell/shistory/nsISHEntry.idl
@@ -188,17 +188,17 @@ interface nsISHEntry : nsISupports
 
     /** Additional ways to create an entry */
     [noscript] void create(in nsIURI URI, in AString title,
                            in nsIInputStream inputStream,
                            in nsILayoutHistoryState layoutHistoryState,
                            in nsISupports cacheKey, in ACString contentType,
                            in nsIPrincipal triggeringPrincipal,
                            in nsIPrincipal principalToInherit,
-                           in unsigned long long docshellID,
+                           in nsIDRef docshellID,
                            in boolean dynamicCreation);
 
     nsISHEntry clone();
 
     /** Attribute that indicates if this entry is for a subframe navigation */
     void setIsSubFrame(in boolean aFlag);
 
     /** Return any content viewer present in or below this node in the
@@ -252,17 +252,22 @@ interface nsISHEntry : nsISupports
      * Returns true if any of the child entries returns true
      * when isDynamicallyAdded is called on it.
      */
     boolean hasDynamicallyAddedChild();
 
     /**
      * The history ID of the docshell.
      */
-    attribute unsigned long long docshellID;
+    attribute nsIDPtr docshellID;
+
+    /**
+     * Helper method for accessing this value from C++
+     */
+    [noscript, notxpcom] nsID DocshellID();
 
     readonly attribute nsIBFCacheEntry BFCacheEntry;
 
     /**
      * Does this SHEntry point to the given BFCache entry?  If so, evicting
      * the BFCache entry will evict the SHEntry, since the two entries
      * correspond to the same document.
      */
--- a/docshell/shistory/nsISHistoryInternal.idl
+++ b/docshell/shistory/nsISHistoryInternal.idl
@@ -17,17 +17,17 @@ interface nsIURI;
 { 0x3dfb2f54, 0x378d, 0x4d3c, \
   { 0xa9, 0xf9, 0x95, 0xdd, 0x26, 0x73, 0x24, 0x8c } }
 
 #define NS_SHISTORY_INTERNAL_CONTRACTID "@mozilla.org/browser/shistory-internal;1"
 
 #include "nsTArrayForwardDeclare.h"
 %}
 
-[ref] native nsDocshellIDArray(nsTArray<uint64_t>);
+[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
--- a/docshell/shistory/nsSHEntry.cpp
+++ b/docshell/shistory/nsSHEntry.cpp
@@ -408,17 +408,17 @@ nsSHEntry::SetContentType(const nsACStri
 
 NS_IMETHODIMP
 nsSHEntry::Create(nsIURI* aURI, const nsAString& aTitle,
                   nsIInputStream* aInputStream,
                   nsILayoutHistoryState* aLayoutHistoryState,
                   nsISupports* aCacheKey, const nsACString& aContentType,
                   nsIPrincipal* aTriggeringPrincipal,
                   nsIPrincipal* aPrincipalToInherit,
-                  uint64_t aDocShellID,
+                  const nsID& aDocShellID,
                   bool aDynamicCreation)
 {
   mURI = aURI;
   mTitle = aTitle;
   mPostData = aInputStream;
 
   // Set the LoadType by default to loadHistory during creation
   mLoadType = (uint32_t)nsIDocShellLoadInfo::loadHistory;
@@ -780,23 +780,20 @@ nsSHEntry::GetChildAt(int32_t aIndex, ns
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::ReplaceChild(nsISHEntry* aNewEntry)
 {
   NS_ENSURE_STATE(aNewEntry);
 
-  uint64_t docshellID;
-  aNewEntry->GetDocshellID(&docshellID);
+  nsID docshellID = aNewEntry->DocshellID();
 
-  uint64_t otherID;
   for (int32_t i = 0; i < mChildren.Count(); ++i) {
-    if (mChildren[i] && NS_SUCCEEDED(mChildren[i]->GetDocshellID(&otherID)) &&
-        docshellID == otherID) {
+    if (mChildren[i] && docshellID == mChildren[i]->DocshellID()) {
       mChildren[i]->SetParent(nullptr);
       mChildren.ReplaceObjectAt(aNewEntry, i);
       return aNewEntry->SetParent(this);
     }
   }
   return NS_ERROR_FAILURE;
 }
 
@@ -911,26 +908,32 @@ nsSHEntry::HasDynamicallyAddedChild(bool
         break;
       }
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSHEntry::GetDocshellID(uint64_t* aID)
+nsSHEntry::GetDocshellID(nsID** aID)
 {
-  *aID = mShared->mDocShellID;
+  *aID = static_cast<nsID*>(nsMemory::Clone(&mShared->mDocShellID, sizeof(nsID)));
   return NS_OK;
 }
 
+const nsID
+nsSHEntry::DocshellID()
+{
+  return mShared->mDocShellID;
+}
+
 NS_IMETHODIMP
-nsSHEntry::SetDocshellID(uint64_t aID)
+nsSHEntry::SetDocshellID(const nsID* aID)
 {
-  mShared->mDocShellID = aID;
+  mShared->mDocShellID = *aID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::GetLastTouched(uint32_t* aLastTouched)
 {
   *aLastTouched = mShared->mLastTouched;
   return NS_OK;
--- a/docshell/shistory/nsSHEntryShared.cpp
+++ b/docshell/shistory/nsSHEntryShared.cpp
@@ -67,17 +67,17 @@ nsSHEntryShared::EnsureHistoryTracker()
 void
 nsSHEntryShared::Shutdown()
 {
   delete gHistoryTracker;
   gHistoryTracker = nullptr;
 }
 
 nsSHEntryShared::nsSHEntryShared()
-  : mDocShellID(0)
+  : mDocShellID({0})
   , mIsFrameNavigation(false)
   , mSaveLayoutState(true)
   , mSticky(true)
   , mDynamicallyCreated(false)
   , mLastTouched(0)
   , mID(gSHEntrySharedID++)
   , mExpired(false)
   , mViewerBounds(0, 0, 0, 0)
--- a/docshell/shistory/nsSHEntryShared.h
+++ b/docshell/shistory/nsSHEntryShared.h
@@ -63,17 +63,17 @@ private:
   void DropPresentationState();
 
   nsresult SetContentViewer(nsIContentViewer* aViewer);
 
   // See nsISHEntry.idl for an explanation of these members.
 
   // These members are copied by nsSHEntryShared::Duplicate().  If you add a
   // member here, be sure to update the Duplicate() implementation.
-  uint64_t mDocShellID;
+  nsID mDocShellID;
   nsCOMArray<nsIDocShellTreeItem> mChildShells;
   nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
   nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
   nsCString mContentType;
   bool mIsFrameNavigation;
   bool mSaveLayoutState;
   bool mSticky;
   bool mDynamicallyCreated;
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -374,16 +374,23 @@ nsSHistory::Shutdown()
 /* Add an entry to the History list at mIndex and
  * increment the index to point to the new entry
  */
 NS_IMETHODIMP
 nsSHistory::AddEntry(nsISHEntry* aSHEntry, bool aPersist)
 {
   NS_ENSURE_ARG(aSHEntry);
 
+  // If we have a root docshell, update the docshell id of the root shentry to
+  // match the id of that docshell
+  if (mRootDocShell) {
+    nsID docshellID = mRootDocShell->HistoryID();
+    aSHEntry->SetDocshellID(&docshellID);
+  }
+
   nsCOMPtr<nsISHTransaction> currentTxn;
 
   if (mListRoot) {
     GetTransactionAtIndex(mIndex, getter_AddRefs(currentTxn));
   }
 
   bool currentPersist = true;
   if (currentTxn) {
@@ -1272,59 +1279,57 @@ nsSHistory::GloballyEvictAllContentViewe
   int32_t maxViewers = sHistoryMaxTotalViewers;
   sHistoryMaxTotalViewers = 0;
   GloballyEvictContentViewers();
   sHistoryMaxTotalViewers = maxViewers;
 }
 
 void
 GetDynamicChildren(nsISHContainer* aContainer,
-                   nsTArray<uint64_t>& aDocshellIDs,
+                   nsTArray<nsID>& aDocshellIDs,
                    bool aOnlyTopLevelDynamic)
 {
   int32_t count = 0;
   aContainer->GetChildCount(&count);
   for (int32_t i = 0; i < count; ++i) {
     nsCOMPtr<nsISHEntry> child;
     aContainer->GetChildAt(i, getter_AddRefs(child));
     if (child) {
       bool dynAdded = false;
       child->IsDynamicallyAdded(&dynAdded);
       if (dynAdded) {
-        uint64_t docshellID = 0;
-        child->GetDocshellID(&docshellID);
+        nsID docshellID = child->DocshellID();
         aDocshellIDs.AppendElement(docshellID);
       }
       if (!dynAdded || !aOnlyTopLevelDynamic) {
         nsCOMPtr<nsISHContainer> childAsContainer = do_QueryInterface(child);
         if (childAsContainer) {
           GetDynamicChildren(childAsContainer, aDocshellIDs,
                              aOnlyTopLevelDynamic);
         }
       }
     }
   }
 }
 
 bool
 RemoveFromSessionHistoryContainer(nsISHContainer* aContainer,
-                                  nsTArray<uint64_t>& aDocshellIDs)
+                                  nsTArray<nsID>& aDocshellIDs)
 {
   nsCOMPtr<nsISHEntry> root = do_QueryInterface(aContainer);
   NS_ENSURE_TRUE(root, false);
 
   bool didRemove = false;
   int32_t childCount = 0;
   aContainer->GetChildCount(&childCount);
   for (int32_t i = childCount - 1; i >= 0; --i) {
     nsCOMPtr<nsISHEntry> child;
     aContainer->GetChildAt(i, getter_AddRefs(child));
     if (child) {
-      uint64_t docshelldID = 0;
-      child->GetDocshellID(&docshelldID);
+      nsID docshelldID = child->DocshellID();
       if (aDocshellIDs.Contains(docshelldID)) {
         didRemove = true;
         aContainer->RemoveChild(child);
       } else {
         nsCOMPtr<nsISHContainer> container = do_QueryInterface(child);
         if (container) {
           bool childRemoved =
             RemoveFromSessionHistoryContainer(container, aDocshellIDs);
@@ -1335,17 +1340,17 @@ RemoveFromSessionHistoryContainer(nsISHC
       }
     }
   }
   return didRemove;
 }
 
 bool
 RemoveChildEntries(nsISHistory* aHistory, int32_t aIndex,
-                   nsTArray<uint64_t>& aEntryIDs)
+                   nsTArray<nsID>& aEntryIDs)
 {
   nsCOMPtr<nsISHEntry> rootHE;
   aHistory->GetEntryAtIndex(aIndex, false, getter_AddRefs(rootHE));
   nsCOMPtr<nsISHContainer> root = do_QueryInterface(rootHE);
   return root ? RemoveFromSessionHistoryContainer(root, aEntryIDs) : false;
 }
 
 bool
@@ -1450,17 +1455,17 @@ nsSHistory::RemoveDuplicate(int32_t aInd
     mEntriesInFollowingPartialHistories = 0;
     NOTIFY_LISTENERS(OnLengthChange, (mLength));
     return true;
   }
   return false;
 }
 
 NS_IMETHODIMP_(void)
-nsSHistory::RemoveEntries(nsTArray<uint64_t>& aIDs, int32_t aStartIndex)
+nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex)
 {
   int32_t index = aStartIndex;
   while (index >= 0 && RemoveChildEntries(this, --index, aIDs)) {
   }
   int32_t minIndex = index;
   index = aStartIndex;
   while (index >= 0 && RemoveChildEntries(this, index++, aIDs)) {
   }
@@ -1482,26 +1487,26 @@ nsSHistory::RemoveEntries(nsTArray<uint6
 void
 nsSHistory::RemoveDynEntries(int32_t aOldIndex, int32_t aNewIndex)
 {
   // Search for the entries which are in the current index,
   // but not in the new one.
   nsCOMPtr<nsISHEntry> originalSH;
   GetEntryAtIndex(aOldIndex, false, getter_AddRefs(originalSH));
   nsCOMPtr<nsISHContainer> originalContainer = do_QueryInterface(originalSH);
-  AutoTArray<uint64_t, 16> toBeRemovedEntries;
+  AutoTArray<nsID, 16> toBeRemovedEntries;
   if (originalContainer) {
-    nsTArray<uint64_t> originalDynDocShellIDs;
+    nsTArray<nsID> originalDynDocShellIDs;
     GetDynamicChildren(originalContainer, originalDynDocShellIDs, true);
     if (originalDynDocShellIDs.Length()) {
       nsCOMPtr<nsISHEntry> currentSH;
       GetEntryAtIndex(aNewIndex, false, getter_AddRefs(currentSH));
       nsCOMPtr<nsISHContainer> newContainer = do_QueryInterface(currentSH);
       if (newContainer) {
-        nsTArray<uint64_t> newDynDocShellIDs;
+        nsTArray<nsID> newDynDocShellIDs;
         GetDynamicChildren(newContainer, newDynDocShellIDs, false);
         for (uint32_t i = 0; i < originalDynDocShellIDs.Length(); ++i) {
           if (!newDynDocShellIDs.Contains(originalDynDocShellIDs[i])) {
             toBeRemovedEntries.AppendElement(originalDynDocShellIDs[i]);
           }
         }
       }
     }
@@ -1770,44 +1775,41 @@ nsSHistory::LoadDifferingEntries(nsISHEn
   // Search for something to load next.
   for (int32_t i = 0; i < ncnt; ++i) {
     // First get an entry which may cause a new page to be loaded.
     nsCOMPtr<nsISHEntry> nChild;
     nextContainer->GetChildAt(i, getter_AddRefs(nChild));
     if (!nChild) {
       continue;
     }
-    uint64_t docshellID = 0;
-    nChild->GetDocshellID(&docshellID);
+    nsID docshellID = nChild->DocshellID();
 
     // Then find the associated docshell.
     nsIDocShell* dsChild = nullptr;
     int32_t count = docshells.Count();
     for (int32_t j = 0; j < count; ++j) {
-      uint64_t shellID = 0;
       nsIDocShell* shell = docshells[j];
-      shell->GetHistoryID(&shellID);
+      nsID shellID = shell->HistoryID();
       if (shellID == docshellID) {
         dsChild = shell;
         break;
       }
     }
     if (!dsChild) {
       continue;
     }
 
     // Then look at the previous entries to see if there was
     // an entry for the docshell.
     nsCOMPtr<nsISHEntry> pChild;
     for (int32_t k = 0; k < pcnt; ++k) {
       nsCOMPtr<nsISHEntry> child;
       prevContainer->GetChildAt(k, getter_AddRefs(child));
       if (child) {
-        uint64_t dID = 0;
-        child->GetDocshellID(&dID);
+        nsID dID = child->DocshellID();
         if (dID == docshellID) {
           pChild = child;
           break;
         }
       }
     }
 
     // Finally recursively call this method.