From 7a9c465cf3ee90ce45ed314b54136fb11466ea77 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 7 Sep 2017 16:49:45 +0200 Subject: [PATCH] Backed out changeset 58fe37290a82 (bug 1364364) --- docshell/shistory/nsISHistoryInternal.idl | 14 -------- docshell/shistory/nsSHistory.cpp | 43 +++-------------------- docshell/shistory/nsSHistory.h | 6 ---- 3 files changed, 5 insertions(+), 58 deletions(-) diff --git a/docshell/shistory/nsISHistoryInternal.idl b/docshell/shistory/nsISHistoryInternal.idl index 22af9d85f8d2..ae0a1facf073 100644 --- a/docshell/shistory/nsISHistoryInternal.idl +++ b/docshell/shistory/nsISHistoryInternal.idl @@ -120,20 +120,6 @@ interface nsISHistoryInternal: nsISupports [noscript, notxpcom] void RemoveDynEntries(in long aIndex, in nsISHContainer aContainer); - /** - * 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. diff --git a/docshell/shistory/nsSHistory.cpp b/docshell/shistory/nsSHistory.cpp index a3419d88bd3e..d36a7582fdb4 100644 --- a/docshell/shistory/nsSHistory.cpp +++ b/docshell/shistory/nsSHistory.cpp @@ -213,7 +213,7 @@ nsSHistory::EvictContentViewerForTransaction(nsISHTransaction* aTrans) LOG_SHENTRY_SPEC(("Evicting content viewer 0x%p for " "owning SHEntry 0x%p at %s.", viewer.get(), ownerEntry.get(), _spec), - ownerEntry); + ownerEntry); // Drop the presentation state before destroying the viewer, so that // document teardown is able to correctly persist the state. @@ -1290,13 +1290,8 @@ nsSHistory::GloballyEvictContentViewers() } nsresult -nsSHistory::FindTransactionForBFCache(nsIBFCacheEntry* aEntry, - nsISHTransaction** aResult, - int32_t* aResultIndex) +nsSHistory::EvictExpiredContentViewerForEntry(nsIBFCacheEntry* aEntry) { - *aResult = nullptr; - *aResultIndex = -1; - int32_t startIndex = std::max(0, mIndex - nsISHistory::VIEWER_WINDOW); int32_t endIndex = std::min(mLength - 1, mIndex + nsISHistory::VIEWER_WINDOW); nsCOMPtr trans; @@ -1316,29 +1311,15 @@ nsSHistory::FindTransactionForBFCache(nsIBFCacheEntry* aEntry, temp->GetNext(getter_AddRefs(trans)); } if (i > endIndex) { - return NS_ERROR_FAILURE; + return NS_OK; } - trans.forget(aResult); - *aResultIndex = i; - return NS_OK; -} - -nsresult -nsSHistory::EvictExpiredContentViewerForEntry(nsIBFCacheEntry* aEntry) -{ - int32_t index; - nsCOMPtr trans; - FindTransactionForBFCache(aEntry, getter_AddRefs(trans), &index); - - if (index == mIndex) { + if (i == mIndex) { NS_WARNING("How did the current SHEntry expire?"); return NS_OK; } - if (trans) { - EvictContentViewerForTransaction(trans); - } + EvictContentViewerForTransaction(trans); return NS_OK; } @@ -1605,20 +1586,6 @@ nsSHistory::RemoveDynEntries(int32_t aIndex, nsISHContainer* aContainer) } } -void -nsSHistory::RemoveDynEntriesForBFCacheEntry(nsIBFCacheEntry* aEntry) -{ - int32_t index; - nsCOMPtr trans; - FindTransactionForBFCache(aEntry, getter_AddRefs(trans), &index); - if (trans) { - nsCOMPtr entry; - trans->GetSHEntry(getter_AddRefs(entry)); - nsCOMPtr container(do_QueryInterface(entry)); - RemoveDynEntries(index, container); - } -} - NS_IMETHODIMP nsSHistory::UpdateIndex() { diff --git a/docshell/shistory/nsSHistory.h b/docshell/shistory/nsSHistory.h index 41d0186e771b..a8933ad17763 100644 --- a/docshell/shistory/nsSHistory.h +++ b/docshell/shistory/nsSHistory.h @@ -96,12 +96,6 @@ private: nsresult PrintHistory(); #endif - // Find the transaction for a given bfcache entry. It only looks up between - // the range where alive viewers may exist (i.e nsISHistory::VIEWER_WINDOW). - nsresult FindTransactionForBFCache(nsIBFCacheEntry* aEntry, - nsISHTransaction** aResult, - int32_t* aResultIndex); - // Evict content viewers in this window which don't lie in the "safe" range // around aIndex. void EvictOutOfRangeWindowContentViewers(int32_t aIndex);