diff --git a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp index 9220e166bed..fc681f2a879 100644 --- a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp +++ b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp @@ -405,6 +405,31 @@ nsSHistory::RemoveSHistoryListener(nsISHistoryListener * aListener) return NS_OK; } +/* Replace an entry in the History list at a particular index. + * Do not update index or count. + */ +NS_IMETHODIMP +nsSHistory::ReplaceEntry(PRInt32 aIndex, nsISHEntry * aReplaceEntry) +{ + NS_ENSURE_ARG(aReplaceEntry); + nsresult rv; + nsCOMPtr currentTxn; + + if (!mListRoot) // Session History is not initialised. + return NS_ERROR_FAILURE; + + rv = GetTransactionAtIndex(aIndex, getter_AddRefs(currentTxn)); + + if(currentTxn) + { + // Set the replacement entry in the transaction + rv = currentTxn->SetSHEntry(aReplaceEntry); + rv = currentTxn->SetPersist(PR_TRUE); + } + return rv; +} + + //***************************************************************************** // nsSHistory: nsIWebNavigation //*****************************************************************************