Backed out changeset 3049f6d7bb50
authorMarco Bonardo <mbonardo@mozilla.com>
Sat, 16 Jan 2010 06:46:24 -0800
changeset 37253 a8015e4b0836e9ce77e38166f01e55acec1a8d00
parent 37248 3049f6d7bb50ff12215800939277db11788e7e59
child 37254 73ded1179009f588efa01d6dafabb85cb2264fc9
push idunknown
push userunknown
push dateunknown
milestone1.9.3a1pre
backs out3049f6d7bb50ff12215800939277db11788e7e59
Backed out changeset 3049f6d7bb50
toolkit/components/places/src/nsNavBookmarks.cpp
toolkit/components/places/src/nsNavHistory.cpp
toolkit/components/places/src/nsPlacesMacros.h
--- a/toolkit/components/places/src/nsNavBookmarks.cpp
+++ b/toolkit/components/places/src/nsNavBookmarks.cpp
@@ -1205,39 +1205,40 @@ nsNavBookmarks::InsertBookmark(PRInt64 a
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = AddBookmarkToHash(childID, 0);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemAdded(*aNewBookmarkId, aFolder, index, TYPE_BOOKMARK));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemAdded(*aNewBookmarkId, aFolder, index, TYPE_BOOKMARK));
 
   // If the bookmark has been added to a tag container, notify all
   // bookmark-folder result nodes which contain a bookmark for the new
   // bookmark's url
   PRInt64 grandParentId;
   rv = GetFolderIdForItem(aFolder, &grandParentId);
   NS_ENSURE_SUCCESS(rv, rv);
   if (grandParentId == mTagRoot) {
     // query for all bookmarks for that URI, notify for each
     nsTArray<PRInt64> bookmarks;
     rv = GetBookmarkIdsForURITArray(aURI, bookmarks);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (bookmarks.Length()) {
       for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
-        NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                         nsINavBookmarkObserver,
-                         OnItemChanged(bookmarks[i], NS_LITERAL_CSTRING("tags"),
-                                       PR_FALSE, EmptyCString(), 0,
-                                       TYPE_BOOKMARK));
+        ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                            OnItemChanged(bookmarks[i],
+                                          NS_LITERAL_CSTRING("tags"),
+                                          PR_FALSE,
+                                          EmptyCString(),
+                                          0,
+                                          TYPE_BOOKMARK));
       }
     }
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
@@ -1278,19 +1279,18 @@ nsNavBookmarks::RemoveItem(PRInt64 aItem
   }
 
   if (itemType == TYPE_FOLDER) {
     rv = RemoveFolder(aItemId);
     NS_ENSURE_SUCCESS(rv, rv);
     return NS_OK;
   }
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnBeforeItemRemoved(aItemId, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnBeforeItemRemoved(aItemId, itemType));
 
   mozStorageTransaction transaction(mDBConn, PR_FALSE);
 
   // First, remove item annotations
   nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
   NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
   rv = annosvc->RemoveItemAnnotations(aItemId);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1323,19 +1323,18 @@ nsNavBookmarks::RemoveItem(PRInt64 aItem
     // Although we removed aItemId, placeId may still be bookmarked elsewhere;
     // IsRealBookmark will know.
     nsNavHistory* history = nsNavHistory::GetHistoryService();
     NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
     rv = history->UpdateFrecency(placeId, IsRealBookmark(placeId));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemRemoved(aItemId, folderId, childIndex, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemRemoved(aItemId, folderId, childIndex, itemType));
 
   if (itemType == TYPE_BOOKMARK) {
     // If the removed bookmark was a child of a tag container, notify all
     // bookmark-folder result nodes which contain a bookmark for the removed
     // bookmark's url.
     PRInt64 grandParentId;
     rv = GetFolderIdForItem(folderId, &grandParentId);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1345,21 +1344,23 @@ nsNavBookmarks::RemoveItem(PRInt64 aItem
       NS_ENSURE_SUCCESS(rv, rv);
       nsTArray<PRInt64> bookmarks;
 
       rv = GetBookmarkIdsForURITArray(uri, bookmarks);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (bookmarks.Length()) {
         for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
-          NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                           nsINavBookmarkObserver,
-                           OnItemChanged(bookmarks[i],
-                                         NS_LITERAL_CSTRING("tags"), PR_FALSE,
-                                         EmptyCString(), 0, TYPE_BOOKMARK));
+          ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                              OnItemChanged(bookmarks[i],
+                                            NS_LITERAL_CSTRING("tags"),
+                                            PR_FALSE,
+                                            EmptyCString(),
+                                            0,
+                                            TYPE_BOOKMARK));
         }
       }
     }
   }
   return NS_OK;
 }
 
 
@@ -1470,19 +1471,18 @@ nsNavBookmarks::CreateContainerWithID(PR
                                              : DYNAMIC_CONTAINER;
   rv = InsertBookmarkInDB(aItemId, nsnull, containerType, aParent, index,
                           aName, PR_Now(), nsnull, aContractId, aNewFolder);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemAdded(*aNewFolder, aParent, index, containerType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemAdded(*aNewFolder, aParent, index, containerType));
 
   *aIndex = index;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::InsertSeparator(PRInt64 aParent,
@@ -1516,19 +1516,18 @@ nsNavBookmarks::InsertSeparator(PRInt64 
   rv = InsertBookmarkInDB(-1, nsnull, SEPARATOR, aParent, index,
                           voidString, PR_Now(), nsnull, EmptyString(),
                           aNewItemId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR));
 
   return NS_OK;
 }
 
 
 nsresult
 nsNavBookmarks::GetLastChildId(PRInt64 aFolderId, PRInt64* aItemId)
 {
@@ -1609,19 +1608,18 @@ nsNavBookmarks::GetParentAndIndexOfFolde
 }
 
 
 nsresult
 nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
 {
   NS_ENSURE_TRUE(aFolderId != mRoot, NS_ERROR_INVALID_ARG);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnBeforeItemRemoved(aFolderId, TYPE_FOLDER));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnBeforeItemRemoved(aFolderId, TYPE_FOLDER));
 
   mozStorageTransaction transaction(mDBConn, PR_FALSE);
 
   nsresult rv;
   PRInt64 parent;
   PRInt32 index, type;
   nsCAutoString folderType;
   {
@@ -1689,19 +1687,18 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFo
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aFolderId == mToolbarFolder) {
     mToolbarFolder = 0;
   }
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemRemoved(aFolderId, parent, index, TYPE_FOLDER));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemRemoved(aFolderId, parent, index, TYPE_FOLDER));
 
   return NS_OK;
 }
 
 
 NS_IMPL_ISUPPORTS1(nsNavBookmarks::RemoveFolderTransaction, nsITransaction)
 
 NS_IMETHODIMP
@@ -1822,19 +1819,18 @@ nsNavBookmarks::RemoveFolderChildren(PRI
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Build a string of folders whose children will be removed.
   nsCString foldersToRemove;
   for (PRUint32 i = 0; i < folderChildrenArray.Length(); i++) {
     folderChildrenInfo child = folderChildrenArray[i];
 
     // Notify observers that we are about to remove this child.
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavBookmarkObserver,
-                     OnBeforeItemRemoved(child.itemId, child.itemType));
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                        OnBeforeItemRemoved(child.itemId, child.itemType));
 
     if (child.itemType == TYPE_FOLDER) {
       foldersToRemove.AppendLiteral(",");
       foldersToRemove.AppendInt(child.itemId);
 
       // If this is a dynamic container, try to notify its service that we
       // are going to remove it.
       // XXX (bug 484094) this should use a bookmark observer!
@@ -1899,20 +1895,21 @@ nsNavBookmarks::RemoveFolderChildren(PRI
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Call observers in reverse order to serve children before their parent.
   for (PRInt32 i = folderChildrenArray.Length() - 1; i >= 0 ; i--) {
     folderChildrenInfo child = folderChildrenArray[i];
 
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavBookmarkObserver,
-                     OnItemRemoved(child.itemId, child.parentId, child.index,
-                                   child.itemType));
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                        OnItemRemoved(child.itemId,
+                                      child.parentId,
+                                      child.index,
+                                      child.itemType));
 
     if (child.itemType == TYPE_BOOKMARK) {
       // If the removed bookmark was a child of a tag container, notify all
       // bookmark-folder result nodes which contain a bookmark for the removed
       // bookmark's url.
 
       if (child.grandParentId == mTagRoot) {
         nsCOMPtr<nsIURI> uri;
@@ -1920,21 +1917,23 @@ nsNavBookmarks::RemoveFolderChildren(PRI
         NS_ENSURE_SUCCESS(rv, rv);
 
         nsTArray<PRInt64> bookmarks;
         rv = GetBookmarkIdsForURITArray(uri, bookmarks);
         NS_ENSURE_SUCCESS(rv, rv);
 
         if (bookmarks.Length()) {
           for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
-            NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                             nsINavBookmarkObserver,
-                             OnItemChanged(bookmarks[i],
-                                           NS_LITERAL_CSTRING("tags"), PR_FALSE,
-                                           EmptyCString(), 0, TYPE_BOOKMARK));
+            ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                                OnItemChanged(bookmarks[i],
+                                              NS_LITERAL_CSTRING("tags"),
+                                              PR_FALSE,
+                                              EmptyCString(),
+                                              0,
+                                              TYPE_BOOKMARK));
           }
         }
       }
     }
   }
 
   return NS_OK;
 }
@@ -2091,20 +2090,20 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetItemDateInternal(GetStatement(mDBSetItemLastModified),
                            aNewParent, now);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemMoved(aItemId, oldParent, oldIndex, aNewParent,
-                               newIndex, itemType));
+  // notify bookmark observers
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemMoved(aItemId, oldParent, oldIndex, aNewParent,
+                                  newIndex, itemType));
 
   // notify dynamic container provider if there is one
   if (!folderType.IsEmpty()) {
     nsCOMPtr<nsIDynamicContainer> container =
       do_GetService(folderType.get(), &rv);
     if (NS_SUCCEEDED(rv)) {
       rv = container->OnContainerMoved(aItemId, aNewParent, newIndex);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -2145,22 +2144,22 @@ nsNavBookmarks::SetItemDateAdded(PRInt64
   nsresult rv = GetItemType(aItemId, &itemType);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetItemDateInternal(GetStatement(mDBSetItemDateAdded),
                            aItemId, aDateAdded);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Note: mDBSetItemDateAdded also sets lastModified to aDateAdded.
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aItemId, NS_LITERAL_CSTRING("dateAdded"),
-                                 PR_FALSE,
-                                 nsPrintfCString(16, "%lld", aDateAdded),
-                                 aDateAdded, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemChanged(aItemId, NS_LITERAL_CSTRING("dateAdded"),
+                                    PR_FALSE,
+                                    nsPrintfCString(16, "%lld", aDateAdded),
+                                    aDateAdded,
+                                    itemType));
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::GetItemDateAdded(PRInt64 aItemId, PRTime* _dateAdded)
 {
   NS_ENSURE_ARG_MIN(aItemId, 1);
@@ -2189,22 +2188,23 @@ nsNavBookmarks::SetItemLastModified(PRIn
   PRUint16 itemType;
   nsresult rv = GetItemType(aItemId, &itemType);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetItemDateInternal(GetStatement(mDBSetItemLastModified),
                            aItemId, aLastModified);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aItemId, NS_LITERAL_CSTRING("lastModified"),
-                                 PR_FALSE,
-                                 nsPrintfCString(16, "%lld", aLastModified),
-                                 aLastModified, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemChanged(aItemId,
+                                    NS_LITERAL_CSTRING("lastModified"),
+                                    PR_FALSE,
+                                    nsPrintfCString(16, "%lld", aLastModified),
+                                    aLastModified,
+                                    itemType));
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::GetItemLastModified(PRInt64 aItemId, PRTime* aLastModified)
 {
   NS_ENSURE_ARG_MIN(aItemId, 1);
@@ -2337,20 +2337,23 @@ nsNavBookmarks::SetItemTitle(PRInt64 aIt
   rv = statement->BindInt64Parameter(1, lastModified);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = statement->BindInt64Parameter(2, aItemId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = statement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aItemId, NS_LITERAL_CSTRING("title"), PR_FALSE,
-                                 aTitle, lastModified, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemChanged(aItemId,
+                                    NS_LITERAL_CSTRING("title"),
+                                    PR_FALSE,
+                                    aTitle,
+                                    lastModified,
+                                    itemType));
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::GetItemTitle(PRInt64 aItemId, nsACString& aTitle)
 {
   NS_ENSURE_ARG_MIN(aItemId, 1);
@@ -2764,20 +2767,19 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt6
   rv = history->UpdateFrecency(oldPlaceId, IsRealBookmark(oldPlaceId));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCAutoString spec;
   rv = aNewURI->GetSpec(spec);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Pass the new URI to OnItemChanged.
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("uri"),
-                                 PR_FALSE, spec, lastModified, TYPE_BOOKMARK));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+    OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("uri"), PR_FALSE, spec,
+                  lastModified, TYPE_BOOKMARK));
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::GetFolderIdForItem(PRInt64 aItemId, PRInt64* aFolderId)
 {
@@ -2927,20 +2929,19 @@ nsNavBookmarks::SetItemIndex(PRInt64 aIt
   rv = stmt->BindInt64Parameter(0, aItemId);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->BindInt32Parameter(1, aNewIndex);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = stmt->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemMoved(aItemId, parent, oldIndex, parent, aNewIndex,
-                               itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemMoved(aItemId, parent, oldIndex, parent,
+                                  aNewIndex, itemType));
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId,
                                       const nsAString& aKeyword)
@@ -3019,21 +3020,20 @@ nsNavBookmarks::SetKeywordForBookmark(PR
   NS_ENSURE_SUCCESS(rv, rv);
   rv = updateKeywordStmnt->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Pass the new keyword to OnItemChanged.
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("keyword"),
-                                 PR_FALSE, NS_ConvertUTF16toUTF8(aKeyword),
-                                 lastModified, TYPE_BOOKMARK));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                      OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("keyword"),
+                                    PR_FALSE, NS_ConvertUTF16toUTF8(aKeyword),
+                                    lastModified, TYPE_BOOKMARK));
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword)
 {
@@ -3119,32 +3119,32 @@ nsNavBookmarks::BeginUpdateBatch()
   if (mBatchLevel++ == 0) {
     mozIStorageConnection* conn = mDBConn;
     PRBool transactionInProgress = PR_TRUE; // default to no transaction on err
     conn->GetTransactionInProgress(&transactionInProgress);
     mBatchHasTransaction = ! transactionInProgress;
     if (mBatchHasTransaction)
       conn->BeginTransaction();
 
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavBookmarkObserver, OnBeginUpdateBatch());
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                        OnBeginUpdateBatch());
   }
   return NS_OK;
 }
 
 
 nsresult
 nsNavBookmarks::EndUpdateBatch()
 {
   if (--mBatchLevel == 0) {
     if (mBatchHasTransaction)
       mDBConn->CommitTransaction();
     mBatchHasTransaction = PR_FALSE;
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavBookmarkObserver, OnEndUpdateBatch());
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                        OnEndUpdateBatch());
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
                                nsISupports* aUserData) {
@@ -3204,19 +3204,18 @@ nsNavBookmarks::OnVisit(nsIURI* aURI, PR
     // query for all bookmarks for that URI, notify for each
     nsTArray<PRInt64> bookmarks;
 
     nsresult rv = GetBookmarkIdsForURITArray(aURI, bookmarks);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (bookmarks.Length()) {
       for (PRUint32 i = 0; i < bookmarks.Length(); i++)
-        NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                         nsINavBookmarkObserver,
-                         OnItemVisited(bookmarks[i], aVisitID, aTime));
+        ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                            OnItemVisited(bookmarks[i], aVisitID, aTime));
     }
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::OnBeforeDeleteURI(nsIURI* aURI)
@@ -3235,22 +3234,23 @@ nsNavBookmarks::OnDeleteURI(nsIURI* aURI
     // query for all bookmarks for that URI, notify for each 
     nsTArray<PRInt64> bookmarks;
 
     nsresult rv = GetBookmarkIdsForURITArray(aURI, bookmarks);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (bookmarks.Length()) {
       for (PRUint32 i = 0; i < bookmarks.Length(); i ++)
-        NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                         nsINavBookmarkObserver,
-                         OnItemChanged(bookmarks[i],
-                                       NS_LITERAL_CSTRING("cleartime"),
-                                       PR_FALSE, EmptyCString(), 0,
-                                       TYPE_BOOKMARK));
+        ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                            OnItemChanged(bookmarks[i],
+                                          NS_LITERAL_CSTRING("cleartime"),
+                                          PR_FALSE,
+                                          EmptyCString(),
+                                          0,
+                                          TYPE_BOOKMARK));
     }
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::OnClearHistory()
@@ -3290,39 +3290,39 @@ nsNavBookmarks::OnPageChanged(nsIURI* aU
       nsCOMArray<nsNavHistoryQuery> queries;
       nsCOMPtr<nsNavHistoryQueryOptions> options;
       rv = history->QueryStringToQueryArray(spec, &queries, getter_AddRefs(options));
       NS_ENSURE_SUCCESS(rv, rv);
 
       NS_ENSURE_STATE(queries.Count() == 1);
       NS_ENSURE_STATE(queries[0]->Folders().Length() == 1);
 
-      NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                       nsINavBookmarkObserver,
-                       OnItemChanged(queries[0]->Folders()[0],
-                                     NS_LITERAL_CSTRING("favicon"),
-                                     PR_FALSE,
-                                     NS_ConvertUTF16toUTF8(aValue),
-                                     0, TYPE_BOOKMARK));
+      ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                          OnItemChanged(queries[0]->Folders()[0],
+                                        NS_LITERAL_CSTRING("favicon"),
+                                        PR_FALSE,
+                                        NS_ConvertUTF16toUTF8(aValue),
+                                        0,
+                                        TYPE_BOOKMARK));
     }
     else {
       // query for all bookmarks for that URI, notify for each 
       nsTArray<PRInt64> bookmarks;
       rv = GetBookmarkIdsForURITArray(aURI, bookmarks);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (bookmarks.Length()) {
         for (PRUint32 i = 0; i < bookmarks.Length(); i ++)
-          NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                           nsINavBookmarkObserver,
-                           OnItemChanged(bookmarks[i],
-                                         NS_LITERAL_CSTRING("favicon"),
-                                         PR_FALSE,
-                                         NS_ConvertUTF16toUTF8(aValue),
-                                         0, TYPE_BOOKMARK));
+          ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
+                              OnItemChanged(bookmarks[i],
+                                            NS_LITERAL_CSTRING("favicon"),
+                                            PR_FALSE,
+                                            NS_ConvertUTF16toUTF8(aValue),
+                                            0,
+                                            TYPE_BOOKMARK));
       }
     }
   }
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
@@ -3350,20 +3350,20 @@ nsNavBookmarks::OnItemAnnotationSet(PRIn
   nsresult rv = GetItemType(aItemId, &itemType);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRTime lastModified = PR_Now();
   rv = SetItemDateInternal(GetStatement(mDBSetItemLastModified),
                            aItemId, lastModified);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
-                                 lastModified, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                      nsINavBookmarkObserver,
+                      OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
+                                    lastModified, itemType));
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::OnPageAnnotationRemoved(nsIURI* aPage, const nsACString& aName)
 {
@@ -3379,20 +3379,20 @@ nsNavBookmarks::OnItemAnnotationRemoved(
   nsresult rv = GetItemType(aItemId, &itemType);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRTime lastModified = PR_Now();
   rv = SetItemDateInternal(GetStatement(mDBSetItemLastModified),
                            aItemId, lastModified);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavBookmarkObserver,
-                   OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
-                                 lastModified, itemType));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                      nsINavBookmarkObserver,
+                      OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
+                                    lastModified, itemType));
 
   return NS_OK;
 }
 
 
 PRBool
 nsNavBookmarks::ItemExists(PRInt64 aItemId) {
   DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBGetItemProperties);
--- a/toolkit/components/places/src/nsNavHistory.cpp
+++ b/toolkit/components/places/src/nsNavHistory.cpp
@@ -2777,20 +2777,19 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRT
   (void)UpdateFrecency(pageID, bs->IsRealBookmark(pageID));
 
   // Notify observers: The hidden detection code must match that in
   // GetQueryResults to maintain consistency.
   // FIXME bug 325241: make a way to observe hidden URLs
   PRUint32 added = 0;
   if (!hidden && aTransitionType != TRANSITION_EMBED &&
                  aTransitionType != TRANSITION_DOWNLOAD) {
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavHistoryObserver,
-                     OnVisit(aURI, *aVisitID, aTime, aSessionID,
-                             referringVisitID, aTransitionType, &added));
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
+                        OnVisit(aURI, *aVisitID, aTime, aSessionID,
+                                referringVisitID, aTransitionType, &added));
   }
 
   // Normally docshell sends the link visited observer notification for us (this
   // will tell all the documents to update their visited link coloring).
   // However, for redirects (since we implement nsIGlobalHistory3) and downloads
   // (since we implement nsIDownloadHistory) this will not happen and we need to
   // send it ourselves.
   if (newItem && (aIsRedirect || aTransitionType == TRANSITION_DOWNLOAD)) {
@@ -4215,32 +4214,32 @@ nsNavHistory::BeginUpdateBatch()
 {
   if (mBatchLevel++ == 0) {
     PRBool transactionInProgress = PR_TRUE; // default to no transaction on err
     mDBConn->GetTransactionInProgress(&transactionInProgress);
     mBatchHasTransaction = ! transactionInProgress;
     if (mBatchHasTransaction)
       mDBConn->BeginTransaction();
 
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavHistoryObserver, OnBeginUpdateBatch());
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
+                        OnBeginUpdateBatch());
   }
   return NS_OK;
 }
 
 // nsNavHistory::EndUpdateBatch
 nsresult
 nsNavHistory::EndUpdateBatch()
 {
   if (--mBatchLevel == 0) {
     if (mBatchHasTransaction)
       mDBConn->CommitTransaction();
     mBatchHasTransaction = PR_FALSE;
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavHistoryObserver, OnEndUpdateBatch());
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
+                        OnEndUpdateBatch());
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNavHistory::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
                              nsISupports* aUserData)
 {
@@ -4543,26 +4542,26 @@ nsNavHistory::RemovePages(nsIURI **aURIs
 
 NS_IMETHODIMP
 nsNavHistory::RemovePage(nsIURI *aURI)
 {
   NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
   NS_ENSURE_ARG(aURI);
 
   // Before we remove, we have to notify our observers!
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavHistoryObserver, OnBeforeDeleteURI(aURI));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                      nsINavHistoryObserver, OnBeforeDeleteURI(aURI));
 
   nsIURI** URIs = &aURI;
   nsresult rv = RemovePages(URIs, 1, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Notify our observers that the URI has been removed.
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavHistoryObserver, OnDeleteURI(aURI));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                      nsINavHistoryObserver, OnDeleteURI(aURI));
   return NS_OK;
 }
 
 
 // nsNavHistory::RemovePagesFromHost
 //
 //    This function will delete all history information about pages from a
 //    given host. If aEntireDomain is set, we will also delete pages from
@@ -4875,18 +4874,18 @@ nsNavHistory::RemoveAllPages()
   rv = FixInvalidFrecenciesForExcludedPlaces();
   if (NS_FAILED(rv))
     NS_WARNING("failed to fix invalid frecencies");
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expiration will take care of orphans.
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavHistoryObserver, OnClearHistory());
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                      nsINavHistoryObserver, OnClearHistory());
 
   // privacy cleanup, if there's an old history.dat around, just delete it
   nsCOMPtr<nsIFile> oldHistoryFile;
   rv = NS_GetSpecialDirectory(NS_APP_HISTORY_50_FILE,
                               getter_AddRefs(oldHistoryFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRBool fileExists;
@@ -5496,23 +5495,24 @@ nsNavHistory::FinalizeInternalStatements
 // nsPIPlacesHistoryListenersNotifier ******************************************
 
 NS_IMETHODIMP
 nsNavHistory::NotifyOnPageExpired(nsIURI *aURI, PRTime aVisitTime,
                                   PRBool aWholeEntry)
 {
   if (aWholeEntry) {
     // Notify our observers that the page has been removed.
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavHistoryObserver, OnDeleteURI(aURI));
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                        nsINavHistoryObserver, OnDeleteURI(aURI));
   }
   else {
     // Notify our observers that some visits for the page have been removed.
-    NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                     nsINavHistoryObserver, OnDeleteVisits(aURI, aVisitTime));
+    ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
+                        nsINavHistoryObserver,
+                        OnDeleteVisits(aURI, aVisitTime));
   }
 
   return NS_OK;
 }
 
 // nsIObserver *****************************************************************
 
 NS_IMETHODIMP
@@ -6934,18 +6934,18 @@ nsNavHistory::BookmarkIdToResultNode(PRI
 
   return RowToResult(stmt, aOptions, aResult);
 }
 
 void
 nsNavHistory::SendPageChangedNotification(nsIURI* aURI, PRUint32 aWhat,
                                           const nsAString& aValue)
 {
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavHistoryObserver, OnPageChanged(aURI, aWhat, aValue));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
+                      OnPageChanged(aURI, aWhat, aValue));
 }
 
 // nsNavHistory::TitleForDomain
 //
 //    This computes the title for a given domain. Normally, this is just the
 //    domain name, but we specially handle empty cases to give you a nice
 //    localized string.
 
@@ -7067,18 +7067,18 @@ nsNavHistory::SetPageTitleInternal(nsIUR
   // url
   rv = BindStatementURI(mDBSetPlaceTitle, 1, aURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mDBSetPlaceTitle->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // observers (have to check first if it's bookmarked)
-  NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
-                   nsINavHistoryObserver, OnTitleChanged(aURI, aTitle));
+  ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
+                      OnTitleChanged(aURI, aTitle));
 
   return NS_OK;
 }
 
 nsresult
 nsNavHistory::AddPageWithVisits(nsIURI *aURI,
                                 const nsString &aTitle,
                                 PRInt32 aVisitCount,
--- a/toolkit/components/places/src/nsPlacesMacros.h
+++ b/toolkit/components/places/src/nsPlacesMacros.h
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "prtypes.h"
 // Call a method on each observer in a category cache, then call the same
 // method on the observer array.
 
-#define NOTIFY_OBSERVERS(canFire, cache, array, type, method)                  \
+#define ENUMERATE_OBSERVERS(canFire, cache, array, type, method)               \
   PR_BEGIN_MACRO                                                               \
   if (canFire) {                                                               \
     const nsCOMArray<type> &entries = cache.GetEntries();                      \
     for (PRInt32 idx = 0; idx < entries.Count(); ++idx)                        \
         entries[idx]->method;                                                  \
     ENUMERATE_WEAKARRAY(array, type, method)                                   \
   }                                                                            \
   PR_END_MACRO;