Fix for bugs 84556 and 82803 r=valeski sr=rpotts

This commit is contained in:
radha%netscape.com 2001-07-05 14:40:02 +00:00
Родитель 2376a5f282
Коммит 04c2b2028c
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -116,7 +116,7 @@ nsSHistory::AddEntry(nsISHEntry * aSHEntry, PRBool aPersist)
// Notify any listener about the new addition // Notify any listener about the new addition
if (mListener) { if (mListener) {
nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(mListener)); nsCOMPtr<nsISHistoryListener> listener(do_QueryReferent(mListener));
if (listener) { if (listener) {
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIHistoryEntry> hEntry(do_QueryInterface(aSHEntry)); nsCOMPtr<nsIHistoryEntry> hEntry(do_QueryInterface(aSHEntry));
@ -356,7 +356,7 @@ nsSHistory::PurgeHistory(PRInt32 aEntries)
PRBool purgeHistory = PR_TRUE; PRBool purgeHistory = PR_TRUE;
// Notify the listener about the history purge // Notify the listener about the history purge
if (mListener) { if (mListener) {
nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(mListener)); nsCOMPtr<nsISHistoryListener> listener(do_QueryReferent(mListener));
if (listener) { if (listener) {
listener->OnHistoryPurge(aEntries, &purgeHistory); listener->OnHistoryPurge(aEntries, &purgeHistory);
} }
@ -491,7 +491,7 @@ nsSHistory::Reload(PRUint32 aReloadFlags)
// Notify listeners // Notify listeners
PRBool canNavigate = PR_TRUE; PRBool canNavigate = PR_TRUE;
if (mListener) { if (mListener) {
nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(mListener)); nsCOMPtr<nsISHistoryListener> listener(do_QueryReferent(mListener));
// We are reloading. Send Reload notifications. // We are reloading. Send Reload notifications.
// nsDocShellLoadFlagType is not public, where as nsIWebNavigation // nsDocShellLoadFlagType is not public, where as nsIWebNavigation
// is public. So send the reload notifications with the // is public. So send the reload notifications with the
@ -590,7 +590,7 @@ nsSHistory::LoadEntry(PRInt32 aIndex, long aLoadType)
nsCOMPtr<nsIURI> nextURI; nsCOMPtr<nsIURI> nextURI;
nHEntry->GetURI(getter_AddRefs(nextURI)); nHEntry->GetURI(getter_AddRefs(nextURI));
if(mListener) { if(mListener) {
nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(mListener)); nsCOMPtr<nsISHistoryListener> listener(do_QueryReferent(mListener));
if (listener) { if (listener) {
if (mIndex+1 == oldIndex) { if (mIndex+1 == oldIndex) {
// We are going back one entry. Send GoBack notifications // We are going back one entry. Send GoBack notifications
@ -801,7 +801,7 @@ nsSHEnumerator::HasMoreElements(PRBool * aReturn)
PRInt32 cnt; PRInt32 cnt;
*aReturn = PR_FALSE; *aReturn = PR_FALSE;
mSHistory->GetCount(&cnt); mSHistory->GetCount(&cnt);
if (mIndex >= 0 && mIndex < cnt ) { if (mIndex >= -1 && mIndex < (cnt-1) ) {
*aReturn = PR_TRUE; *aReturn = PR_TRUE;
} }
return NS_OK; return NS_OK;