Bug 333109 r=darin. Try to fix crash in OnItemRemoved. This is a workaround

for bug 333016 that prevents attaching multiple observers.

Original committer: brettw%gmail.com
Original revision: 1.67
Original date: 2006/04/10 17:24:14
This commit is contained in:
benjamin%smedbergs.us 2006-07-18 18:34:58 +00:00
Родитель 839e124b99
Коммит 721de4f691
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -3269,6 +3269,10 @@ nsNavHistoryResult::AddEverythingObserver(nsNavHistoryQueryResultNode* aNode)
history->AddObserver(this, PR_TRUE);
mIsHistoryObserver = PR_TRUE;
}
if (mEverythingObservers.IndexOf(aNode) != mEverythingObservers.NoIndex) {
NS_NOTREACHED("Attempting to register an observer twice!");
return;
}
mEverythingObservers.AppendElement(aNode);
}
@ -3291,6 +3295,10 @@ nsNavHistoryResult::AddBookmarkObserver(nsNavHistoryFolderResultNode* aNode,
mIsBookmarksObserver = PR_TRUE;
}
FolderObserverList* list = BookmarkObserversForId(aFolder, PR_TRUE);
if (list->IndexOf(aNode) != list->NoIndex) {
NS_NOTREACHED("Attempting to register an observer twice!");
return;
}
list->AppendElement(aNode);
}