Bug 1485820 - Port bug 1484496 to C-C: Changes to use of nsISimpleEnumerator. rs=jorgk,bustage-fix CLOSED TREE
authoraceman <acelists@atlas.sk>
Thu, 23 Aug 2018 19:01:00 +0200
changeset 32043 1cba27a3d3e8d6c76f009bcac58ac1569ea2ca03
parent 32042 b786d0165808c25cb73b682b7ac948dca4ff6ab2
child 32044 259fe92cbdd47d3d12b910589853b2515249c32d
push id2308
push userclokep@gmail.com
push dateWed, 05 Sep 2018 00:34:58 +0000
treeherdercomm-beta@e326b2dcd127 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk, bustage-fix
bugs1485820, 1484496
Bug 1485820 - Port bug 1484496 to C-C: Changes to use of nsISimpleEnumerator. rs=jorgk,bustage-fix CLOSED TREE
mail/components/shell/DirectoryProvider.cpp
mail/components/shell/DirectoryProvider.h
mailnews/addrbook/src/nsAbBSDirectory.cpp
mailnews/addrbook/src/nsAbCardProperty.cpp
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/base/search/src/nsMsgFilterService.cpp
mailnews/base/src/nsMailDirProvider.cpp
mailnews/base/src/nsMailDirProvider.h
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsMsgGroupThread.cpp
mailnews/base/src/nsSubscribableServer.cpp
mailnews/base/src/nsSubscribeDataSource.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgTxn.cpp
mailnews/compose/src/nsMsgCompFields.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/db/gloda/modules/index_msg.js
mailnews/db/msgdb/public/nsMsgDatabase.h
mailnews/db/msgdb/src/nsMailDatabase.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/db/msgdb/src/nsMsgThread.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/news/src/nsNewsFolder.cpp
rdf/base/nsCompositeDataSource.cpp
rdf/base/nsContainerEnumerator.cpp
rdf/base/nsInMemoryDataSource.cpp
--- a/mail/components/shell/DirectoryProvider.cpp
+++ b/mail/components/shell/DirectoryProvider.cpp
@@ -134,24 +134,22 @@ DirectoryProvider::GetFiles(const char *
     nsCOMPtr<nsIProperties> dirSvc
       (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     if (!dirSvc)
       return NS_ERROR_FAILURE;
 
     nsCOMArray<nsIFile> distroFiles;
     AppendDistroSearchDirs(dirSvc, distroFiles);
 
-    return NS_NewArrayEnumerator(aResult, distroFiles);
+    return NS_NewArrayEnumerator(aResult, distroFiles, NS_GET_IID(nsIFile));
   }
 
   return NS_ERROR_FAILURE;
 }
 
-NS_IMPL_ISUPPORTS(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
-
 NS_IMETHODIMP
 DirectoryProvider::AppendingEnumerator::HasMoreElements(bool *aResult)
 {
   *aResult = mNext ? true : false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/mail/components/shell/DirectoryProvider.h
+++ b/mail/components/shell/DirectoryProvider.h
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef DirectoryProvider_h__
 #define DirectoryProvider_h__
 
 #include "nsIDirectoryService.h"
 #include "nsComponentManagerUtils.h"
-#include "nsISimpleEnumerator.h"
+#include "nsSimpleEnumerator.h"
 #include "nsIFile.h"
 
 #define NS_MAILDIRECTORYPROVIDER_CONTRACTID \
   "@mozilla.org/mail/directory-provider;1"
 
 #define NS_MAILDIRECTORYPROVIDER_CID \
   { 0xa7e8e047, 0xd36e, 0x4605, { 0xa5, 0xab, 0x1a, 0x62, 0x29, 0x03, 0x85, 0x99 }}
 
@@ -31,27 +31,29 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
   DirectoryProvider() {}
 
 private:
   virtual ~DirectoryProvider() {}
-  class AppendingEnumerator : public nsISimpleEnumerator
+  class AppendingEnumerator : public nsSimpleEnumerator
   {
   public:
-    NS_DECL_ISUPPORTS
     NS_DECL_NSISIMPLEENUMERATOR
 
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIFile);
+    }
+
     AppendingEnumerator(nsISimpleEnumerator* aBase,
                         char const *const *aAppendList);
-
   private:
-    virtual ~AppendingEnumerator() {}
     nsCOMPtr<nsISimpleEnumerator> mBase;
     char const *const *const      mAppendList;
     nsCOMPtr<nsIFile>             mNext;
   };
 };
 
 } // namespace mail
 } // namespace mozilla
--- a/mailnews/addrbook/src/nsAbBSDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbBSDirectory.cpp
@@ -88,17 +88,17 @@ nsresult nsAbBSDirectory::CreateDirector
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbBSDirectory::GetChildNodes(nsISimpleEnumerator* *aResult)
 {
   nsresult rv = EnsureInitialized();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return NS_NewArrayEnumerator(aResult, mSubDirectories);
+  return NS_NewArrayEnumerator(aResult, mSubDirectories, NS_GET_IID(nsIAbDirectory));
 }
 
 nsresult nsAbBSDirectory::EnsureInitialized()
 {
   if (mInitialized)
     return NS_OK;
 
   nsresult rv;
--- a/mailnews/addrbook/src/nsAbCardProperty.cpp
+++ b/mailnews/addrbook/src/nsAbCardProperty.cpp
@@ -238,17 +238,17 @@ nsAbSimpleProperty::GetValue(nsIVariant*
 
 NS_IMETHODIMP nsAbCardProperty::GetProperties(nsISimpleEnumerator **props)
 {
   nsCOMArray<nsIProperty> propertyArray(m_properties.Count());
   for (auto iter = m_properties.Iter(); !iter.Done(); iter.Next()) {
     propertyArray.AppendObject(new nsAbSimpleProperty(iter.Key(),
                                                       iter.UserData()));
   }
-  return NS_NewArrayEnumerator(props, propertyArray);
+  return NS_NewArrayEnumerator(props, propertyArray, NS_GET_IID(nsIProperty));
 }
 
 NS_IMETHODIMP nsAbCardProperty::GetProperty(const nsACString &name,
                                             nsIVariant *defaultValue,
                                             nsIVariant **value)
 {
   if (!m_properties.Get(name, value))
     NS_ADDREF(*value = defaultValue);
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -374,17 +374,17 @@ NS_IMETHODIMP nsAbMDBDirectory::GetURI(n
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::GetChildNodes(nsISimpleEnumerator* *aResult)
 {
   if (mIsQueryURI)
     return NS_NewEmptyEnumerator(aResult);
 
-  return NS_NewArrayEnumerator(aResult, mSubDirectories);
+  return NS_NewArrayEnumerator(aResult, mSubDirectories, NS_GET_IID(nsIAbDirectory));
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::GetChildCards(nsISimpleEnumerator* *result)
 {
   nsresult rv;
 
   if (mIsQueryURI)
   {
@@ -393,17 +393,17 @@ NS_IMETHODIMP nsAbMDBDirectory::GetChild
 
     // TODO
     // Search is synchronous so need to return
     // results after search is complete
     nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID));
     for (auto iter = mSearchCache.Iter(); !iter.Done(); iter.Next()) {
       array->AppendElement(iter.Data());
     }
-    return NS_NewArrayEnumerator(result, array);
+    return NS_NewArrayEnumerator(result, array, NS_GET_IID(nsIAbCard));
   }
 
   rv = GetAbDatabase();
 
   if (NS_FAILED(rv) || !mDatabase)
     return rv;
 
   return m_IsMailList ? mDatabase->EnumerateListAddresses(this, result) :
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -22,16 +22,17 @@
 #include "nsIPromptService.h"
 #include "nsIStringBundle.h"
 #include "nsIFile.h"
 #include "nsEmbedCID.h"
 #include "nsIProperty.h"
 #include "nsIVariant.h"
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
+#include "nsSimpleEnumerator.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIAbManager.h"
 #include "mozilla/Services.h"
 
 #define ID_PAB_TABLE            1
 #define ID_DELETEDCARDS_TABLE           2
 
@@ -2295,30 +2296,35 @@ nsresult nsAddrDatabase::GetListFromDB(n
       if(NS_SUCCEEDED(err))
         dbnewList->AddAddressToList(card);
     }
   }
 
   return err;
 }
 
-class nsAddrDBEnumerator : public nsISimpleEnumerator, public nsIAddrDBListener
+class nsAddrDBEnumerator : public nsSimpleEnumerator, public nsIAddrDBListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_ISUPPORTS_INHERITED
+
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIFile);
+    }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
     NS_DECL_NSIADDRDBLISTENER
+
     // nsAddrDBEnumerator methods:
-
     nsAddrDBEnumerator(nsAddrDatabase* aDb);
     void Clear();
 protected:
-    virtual ~nsAddrDBEnumerator();
+    ~nsAddrDBEnumerator() override;
     RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbTableRowCursor> mRowCursor;
     nsCOMPtr<nsIMdbRow> mCurrentRow;
     mdb_pos mRowPos;
 };
 
 nsAddrDBEnumerator::nsAddrDBEnumerator(nsAddrDatabase* aDb)
@@ -2339,17 +2345,17 @@ void nsAddrDBEnumerator::Clear()
 {
   mRowCursor = nullptr;
   mCurrentRow = nullptr;
   mDbTable = nullptr;
   if (mDb)
     mDb->RemoveListener(this);
 }
 
-NS_IMPL_ISUPPORTS(nsAddrDBEnumerator, nsISimpleEnumerator, nsIAddrDBListener)
+NS_IMPL_ISUPPORTS_INHERITED(nsAddrDBEnumerator, nsSimpleEnumerator, nsIAddrDBListener)
 
 NS_IMETHODIMP
 nsAddrDBEnumerator::HasMoreElements(bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
     *aResult = false;
 
     if (!mDbTable || !mDb->GetEnv())
@@ -2461,30 +2467,31 @@ NS_IMETHODIMP nsAddrDBEnumerator::OnList
 
 /* void onAnnouncerGoingAway (); */
 NS_IMETHODIMP nsAddrDBEnumerator::OnAnnouncerGoingAway()
 {
   Clear();
   return NS_OK;
 }
 
-class nsListAddressEnumerator final : public nsISimpleEnumerator
+class nsListAddressEnumerator final : public nsSimpleEnumerator
 {
 public:
-    NS_DECL_ISUPPORTS
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIAbCard);
+    }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsListAddressEnumerator methods:
-
     nsListAddressEnumerator(nsAddrDatabase* aDb, mdb_id aRowID);
 
 protected:
-    ~nsListAddressEnumerator() {}
     RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbRow> mListRow;
     mdb_id mListRowID;
     uint32_t mAddressTotal;
     uint16_t mAddressPos;
 };
 
@@ -2494,18 +2501,16 @@ nsListAddressEnumerator::nsListAddressEn
       mDbTable(aDb->GetPabTable()),
       mListRowID(aRowID),
       mAddressPos(0)
 {
     mDb->GetListRowByRowID(mListRowID, getter_AddRefs(mListRow));
     mAddressTotal = aDb->GetListAddressTotal(mListRow);
 }
 
-NS_IMPL_ISUPPORTS(nsListAddressEnumerator, nsISimpleEnumerator)
-
 NS_IMETHODIMP
 nsListAddressEnumerator::HasMoreElements(bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   *aResult = false;
 
   if (!mDbTable || !mDb->GetEnv())
@@ -2908,17 +2913,17 @@ NS_IMETHODIMP nsAddrDatabase::GetCardsFr
       if (NS_FAILED(CreateABCard(row, 0, getter_AddRefs(card))))
         continue;
       list.AppendObject(card);
     }
     else
       done = true;
   } while (!done);
 
-  return NS_NewArrayEnumerator(cards, list);
+  return NS_NewArrayEnumerator(cards, list, NS_GET_IID(nsIAbCard));
 }
 
 NS_IMETHODIMP nsAddrDatabase::AddListDirNode(nsIMdbRow * listRow)
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
 
--- a/mailnews/base/search/src/nsMsgFilterService.cpp
+++ b/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -918,17 +918,17 @@ NS_IMETHODIMP nsMsgFilterService::AddCus
   mCustomActions.AppendObject(aAction);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilterService::GetCustomActions(nsISimpleEnumerator** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-  return NS_NewArrayEnumerator(aResult, mCustomActions);
+  return NS_NewArrayEnumerator(aResult, mCustomActions, NS_GET_IID(nsIMsgFilterCustomAction));
 }
 
 NS_IMETHODIMP
 nsMsgFilterService::GetCustomAction(const nsACString & aId,
                                     nsIMsgFilterCustomAction** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
@@ -951,17 +951,17 @@ NS_IMETHODIMP nsMsgFilterService::AddCus
   mCustomTerms.AppendObject(aTerm);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilterService::GetCustomTerms(nsISimpleEnumerator** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-  return NS_NewArrayEnumerator(aResult, mCustomTerms);
+  return NS_NewArrayEnumerator(aResult, mCustomTerms, NS_GET_IID(nsIMsgSearchCustomTerm));
 }
 
 NS_IMETHODIMP
 nsMsgFilterService::GetCustomTerm(const nsACString& aId,
                                     nsIMsgSearchCustomTerm** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
--- a/mailnews/base/src/nsMailDirProvider.cpp
+++ b/mailnews/base/src/nsMailDirProvider.cpp
@@ -125,19 +125,16 @@ nsMailDirProvider::GetFiles(const char *
 
   rv = NS_NewUnionEnumerator(getter_AddRefs(combinedEnumerator), directoryEnumerator, extensionsEnum);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ADDREF(*aResult = new AppendingEnumerator(combinedEnumerator));
   return NS_SUCCESS_AGGREGATE_RESULT;
 }
 
-NS_IMPL_ISUPPORTS(nsMailDirProvider::AppendingEnumerator,
-                   nsISimpleEnumerator)
-
 NS_IMETHODIMP
 nsMailDirProvider::AppendingEnumerator::HasMoreElements(bool *aResult)
 {
   *aResult = mNext || mNextWithLocale ? true : false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/mailnews/base/src/nsMailDirProvider.h
+++ b/mailnews/base/src/nsMailDirProvider.h
@@ -2,42 +2,47 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsMailDirProvider_h__
 #define nsMailDirProvider_h__
 
 #include "nsIDirectoryService.h"
-#include "nsISimpleEnumerator.h"
+#include "nsSimpleEnumerator.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
+#include "nsIFile.h"
 
 class nsMailDirProvider final : public nsIDirectoryServiceProvider2
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
 private:
   ~nsMailDirProvider() {}
 
   nsresult EnsureDirectory(nsIFile *aDirectory);
 
-  class AppendingEnumerator final : public nsISimpleEnumerator
+
+  class AppendingEnumerator final : public nsSimpleEnumerator
   {
   public:
-    NS_DECL_ISUPPORTS
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIFile);
+    }
+
     NS_DECL_NSISIMPLEENUMERATOR
 
     AppendingEnumerator(nsISimpleEnumerator* aBase);
 
   private:
-    ~AppendingEnumerator() {}
     nsCOMPtr<nsISimpleEnumerator> mBase;
     nsCOMPtr<nsIFile>             mNext;
     nsCOMPtr<nsIFile>             mNextWithLocale;
     nsCString                     mLocale;
   };
 };
 
 #endif // nsMailDirProvider_h__
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -8832,18 +8832,16 @@ nsMsgDBView::SetMRUTimeForFolder(nsIMsgF
 {
   uint32_t seconds;
   PRTime2Seconds(PR_Now(), &seconds);
   nsAutoCString nowStr;
   nowStr.AppendInt(seconds);
   folder->SetStringProperty(MRU_TIME_PROPERTY, nowStr);
 }
 
-NS_IMPL_ISUPPORTS(nsMsgDBView::nsMsgViewHdrEnumerator, nsISimpleEnumerator)
-
 nsMsgDBView::nsMsgViewHdrEnumerator::nsMsgViewHdrEnumerator(nsMsgDBView *view)
 {
   // We need to clone the view because the caller may clear the
   // current view immediately. It also makes it easier to expand all
   // if we're working on a copy.
   nsCOMPtr<nsIMsgDBView> clonedView;
   view->CloneDBView(nullptr, nullptr, nullptr, getter_AddRefs(clonedView));
   m_view = static_cast<nsMsgDBView*>(clonedView.get());
--- a/mailnews/base/src/nsMsgDBView.h
+++ b/mailnews/base/src/nsMsgDBView.h
@@ -26,16 +26,17 @@
 #include "nsMsgTagService.h"
 #include "nsCOMArray.h"
 #include "nsTArray.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsIMsgCustomColumnHandler.h"
 #include "nsAutoPtr.h"
 #include "nsIWeakReferenceUtils.h"
+#include "nsSimpleEnumerator.h"
 #define MESSENGER_STRING_URL       "chrome://messenger/locale/messenger.properties"
 
 typedef AutoTArray<nsMsgViewIndex, 1> nsMsgViewIndexArray;
 static_assert(nsMsgViewIndex(nsMsgViewIndexArray::NoIndex) ==
   nsMsgViewIndex_None, "These need to be the same value.");
 
 enum eFieldType {
     kCollationKey,
@@ -536,28 +537,31 @@ private:
 
   nsresult PerformActionsOnJunkMsgs(bool msgsAreJunk);
   nsresult DetermineActionsForJunkChange(bool msgsAreJunk,
                                          nsIMsgFolder *srcFolder,
                                          bool &moveMessages,
                                          bool &changeReadState,
                                          nsIMsgFolder** targetFolder);
 
-  class nsMsgViewHdrEnumerator final : public nsISimpleEnumerator
+  class nsMsgViewHdrEnumerator final : public nsSimpleEnumerator
   {
   public:
-    NS_DECL_ISUPPORTS
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIMsgDBHdr);
+    }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsMsgThreadEnumerator methods:
     nsMsgViewHdrEnumerator(nsMsgDBView *view);
 
     RefPtr<nsMsgDBView> m_view;
     nsMsgViewIndex m_curHdrIndex;
 
   private:
-    ~nsMsgViewHdrEnumerator();
+    ~nsMsgViewHdrEnumerator() override;
   };
 };
 
 #endif
--- a/mailnews/base/src/nsMsgGroupThread.cpp
+++ b/mailnews/base/src/nsMsgGroupThread.cpp
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "msgCore.h"
 #include "nsMsgGroupThread.h"
 #include "nsMsgDBView.h"
 #include "nsMsgMessageFlags.h"
 #include "nsMsgUtils.h"
+#include "nsSimpleEnumerator.h"
 
 NS_IMPL_ISUPPORTS(nsMsgGroupThread, nsIMsgThread)
 
 nsMsgGroupThread::nsMsgGroupThread()
 {
   Init();
 }
 
@@ -320,19 +321,22 @@ nsresult nsMsgGroupThread::ReparentChild
 
 NS_IMETHODIMP nsMsgGroupThread::MarkChildRead(bool bRead)
 {
   ChangeUnreadChildCount(bRead ? -1 : 1);
   return NS_OK;
 }
 
 // this could be moved into utils, because I think it's the same as the db impl.
-class nsMsgGroupThreadEnumerator : public nsISimpleEnumerator {
+class nsMsgGroupThreadEnumerator : public nsSimpleEnumerator {
 public:
-  NS_DECL_ISUPPORTS
+  const nsID& DefaultInterface() override
+  {
+    return NS_GET_IID(nsIMsgDBHdr);
+  }
 
   // nsISimpleEnumerator methods:
   NS_DECL_NSISIMPLEENUMERATOR
 
   // nsMsgGroupThreadEnumerator methods:
   typedef nsresult (*nsMsgGroupThreadEnumeratorFilter)(nsIMsgDBHdr* hdr, void* closure);
 
   nsMsgGroupThreadEnumerator(nsMsgGroupThread *thread, nsMsgKey startKey,
@@ -418,18 +422,16 @@ nsMsgGroupThreadEnumerator::nsMsgGroupTh
   }
 #endif
 }
 
 nsMsgGroupThreadEnumerator::~nsMsgGroupThreadEnumerator()
 {
 }
 
-NS_IMPL_ISUPPORTS(nsMsgGroupThreadEnumerator, nsISimpleEnumerator)
-
 int32_t nsMsgGroupThreadEnumerator::MsgKeyFirstChildIndex(nsMsgKey inMsgKey)
 {
   // look through rest of thread looking for a child of this message.
   // If the inMsgKey is the first message in the thread, then all children
   // without parents are considered to be children of inMsgKey.
   // Otherwise, only true children qualify.
   uint32_t numChildren;
   nsCOMPtr<nsIMsgDBHdr> curHdr;
--- a/mailnews/base/src/nsSubscribableServer.cpp
+++ b/mailnews/base/src/nsSubscribableServer.cpp
@@ -825,17 +825,17 @@ nsSubscribableServer::GetChildren(const 
 
         // todo, is this creating nsMsgFolders?
         mRDFService->GetResource(uri, getter_AddRefs(res));
         result.AppendObject(res);
 
         current = current->prevSibling;
     }
 
-    return NS_NewArrayEnumerator(aResult, result);
+    return NS_NewArrayEnumerator(aResult, result, NS_GET_IID(nsIRDFResource));
 }
 
 NS_IMETHODIMP
 nsSubscribableServer::CommitSubscribeChanges()
 {
     NS_ASSERTION(false,"override this.");
     return NS_ERROR_FAILURE;
 }
--- a/mailnews/base/src/nsSubscribeDataSource.cpp
+++ b/mailnews/base/src/nsSubscribeDataSource.cpp
@@ -548,17 +548,17 @@ nsSubscribeDataSource::ArcLabelsOut(nsIR
     array.AppendObject(kNC_Name);
     array.AppendObject(kNC_ServerType);
     array.AppendObject(kNC_LeafName);
 
     if (hasChildren) {
         array.AppendObject(kNC_Child);
     }
 
-    return NS_NewArrayEnumerator(labels, array);
+    return NS_NewArrayEnumerator(labels, array, NS_GET_IID(nsIRDFResource));
 }
 
 NS_IMETHODIMP
 nsSubscribeDataSource::GetAllResources(nsISimpleEnumerator** aCursor)
 {
   MOZ_ASSERT_UNREACHABLE("sorry!");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -2994,17 +2994,17 @@ nsMsgDBFolder::GetURI(nsACString& name)
 typedef bool
 (*nsArrayFilter)(nsISupports* element, void* data);
 #endif
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsMsgDBFolder::GetSubFolders(nsISimpleEnumerator **aResult)
 {
-  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
+  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders, NS_GET_IID(nsIMsgFolder)) : NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::FindSubFolder(const nsACString& aEscapedSubFolderName, nsIMsgFolder **aFolder)
 {
   nsresult rv = NS_OK;
   nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
 
--- a/mailnews/base/util/nsMsgTxn.cpp
+++ b/mailnews/base/util/nsMsgTxn.cpp
@@ -113,17 +113,17 @@ NS_IMETHODIMP nsMailSimpleProperty::GetV
 NS_IMETHODIMP nsMsgTxn::GetEnumerator(nsISimpleEnumerator* *_retval)
 {
   nsCOMArray<nsIProperty> propertyArray;
   for (auto iter = mPropertyHash.Iter(); !iter.Done(); iter.Next()) {
     nsMailSimpleProperty *sprop = new nsMailSimpleProperty(iter.Key(),
                                                            iter.Data());
     propertyArray.AppendObject(sprop);
   }
-  return NS_NewArrayEnumerator(_retval, propertyArray);
+  return NS_NewArrayEnumerator(_retval, propertyArray, NS_GET_IID(nsIProperty));
 }
 
 #define IMPL_GETSETPROPERTY_AS(Name, Type) \
 NS_IMETHODIMP \
 nsMsgTxn::GetPropertyAs ## Name (const nsAString & prop, Type *_retval) \
 { \
     nsIVariant* v = mPropertyHash.GetWeak(prop); \
     if (!v) \
--- a/mailnews/compose/src/nsMsgCompFields.cpp
+++ b/mailnews/compose/src/nsMsgCompFields.cpp
@@ -531,17 +531,17 @@ nsresult nsMsgCompFields::SetBody(const 
 const char* nsMsgCompFields::GetBody()
 {
     return m_body.get();
 }
 
 /* readonly attribute nsISimpleEnumerator attachmentsArray; */
 NS_IMETHODIMP nsMsgCompFields::GetAttachments(nsISimpleEnumerator * *aAttachmentsEnum)
 {
-  return aAttachmentsEnum ? NS_NewArrayEnumerator(aAttachmentsEnum, m_attachments) : NS_ERROR_NULL_POINTER;
+  return aAttachmentsEnum ? NS_NewArrayEnumerator(aAttachmentsEnum, m_attachments, NS_GET_IID(nsIMsgAttachment)) : NS_ERROR_NULL_POINTER;
 }
 
 /* void addAttachment (in nsIMsgAttachment attachment); */
 NS_IMETHODIMP nsMsgCompFields::AddAttachment(nsIMsgAttachment *attachment)
 {
   int32_t attachmentCount = m_attachments.Count();
 
   //Don't add twice the same attachment.
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -807,17 +807,17 @@ nsMsgSendLater::InternalSendMessages(boo
           if (NS_SUCCEEDED(rv) && !(flags & nsMsgMessageFlags::Queued))
             mMessagesToSend.AppendObject(messageHeader);
         }
       }
     }
   }
 
   // Now get an enumerator for our array.
-  rv = NS_NewArrayEnumerator(getter_AddRefs(mEnumerator), mMessagesToSend);
+  rv = NS_NewArrayEnumerator(getter_AddRefs(mEnumerator), mMessagesToSend, NS_GET_IID(nsIMsgDBHdr));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // We're now sending messages so its time to signal that and reset our counts.
   mSendingMessages = true;
   mTotalSentSuccessfully = 0;
   mTotalSendCount = 0;
 
   // Notify the listeners that we are starting a send.
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -380,17 +380,17 @@ nsSmtpService::GetServers(nsISimpleEnume
   NS_ENSURE_ARG_POINTER(aResult);
 
   // now read in the servers from prefs if necessary
   uint32_t serverCount = mSmtpServers.Count();
 
   if (serverCount <= 0)
     loadSmtpServers();
 
-  return NS_NewArrayEnumerator(aResult, mSmtpServers);
+  return NS_NewArrayEnumerator(aResult, mSmtpServers, NS_GET_IID(nsISmtpServer));
 }
 
 nsresult
 nsSmtpService::loadSmtpServers()
 {
   if (mSmtpServersLoaded)
     return NS_OK;
 
--- a/mailnews/db/gloda/modules/index_msg.js
+++ b/mailnews/db/gloda/modules/index_msg.js
@@ -1152,18 +1152,21 @@ var GlodaMsgIndexer = {
     // list of gloda id's to mark deleted
     let deleteGlodaIds = [];
     let exceptionalMessages = {};
 
     // for GC reasons we need to track the number of headers seen
     let numHeadersSeen = 0;
 
     // We are consuming two lists; our loop structure has to reflect that.
-    let headerIter = XPCOMUtils.IterSimpleEnumerator(this._indexingEnumerator,
-                                                     nsIMsgDBHdr);
+    let headerIterator = function* (aEnumerator) {
+      while (aEnumerator.hasMoreElements())
+        yield aEnumerator.getNext().QueryInterface(nsIMsgDBHdr);
+    };
+    let headerIter = headerIterator(this._indexingEnumerator);
     let mayHaveMoreGlodaMessages = true;
     let keepIterHeader = false;
     let keepGlodaTuple = false;
     let msgHdr = null;
     while (headerIter || mayHaveMoreGlodaMessages) {
       let glodaId;
       if (headerIter) {
         if (!keepIterHeader) {
--- a/mailnews/db/msgdb/public/nsMsgDatabase.h
+++ b/mailnews/db/msgdb/public/nsMsgDatabase.h
@@ -23,16 +23,18 @@
 #include "nsICollation.h"
 #include "nsIMsgSearchSession.h"
 #include "nsIMimeConverter.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "PLDHashTable.h"
 #include "nsTArray.h"
 #include "nsTObserverArray.h"
+#include "nsSimpleEnumerator.h"
+
 class ListContext;
 class nsMsgKeySet;
 class nsMsgThread;
 class nsMsgDatabase;
 class nsIMsgThread;
 class nsIDBFolderInfo;
 
 const int32_t kMsgDBVersion = 1;
@@ -68,19 +70,22 @@ protected:
   void FinishDBOpen(nsIMsgFolder *aFolder, nsMsgDatabase *aMsgDB);
   nsMsgDatabase* FindInCache(nsIFile *dbName);
 
   nsCOMArray <nsIMsgFolder> m_foldersPendingListeners;
   nsCOMArray <nsIDBChangeListener> m_pendingListeners;
   AutoTArray<nsMsgDatabase*, kInitialMsgDBCacheSize> m_dbCache;
 };
 
-class nsMsgDBEnumerator : public nsISimpleEnumerator {
+class nsMsgDBEnumerator : public nsSimpleEnumerator {
 public:
-    NS_DECL_ISUPPORTS
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIMsgDBHdr);
+    }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsMsgDBEnumerator methods:
     typedef nsresult (*nsMsgDBEnumeratorFilter)(nsIMsgDBHdr* hdr, void* closure);
 
     nsMsgDBEnumerator(nsMsgDatabase* db, nsIMdbTable *table,
@@ -100,17 +105,17 @@ public:
     nsMsgDBEnumeratorFilter         mFilter;
     nsCOMPtr <nsIMdbTable>          mTable;
     void*                           mClosure;
     // This is used when the caller wants to limit how many headers the
     // enumerator looks at in any given time slice.
     mdb_pos                         mStopPos;
 
 protected:
-    virtual ~nsMsgDBEnumerator();
+    ~nsMsgDBEnumerator() override;
 };
 
 class nsMsgFilteredDBEnumerator : public nsMsgDBEnumerator
 {
 public:
   nsMsgFilteredDBEnumerator(nsMsgDatabase* db, nsIMdbTable *table,
                             bool reverse, nsIArray *searchTerms);
   virtual ~nsMsgFilteredDBEnumerator();
--- a/mailnews/db/msgdb/src/nsMailDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp
@@ -9,16 +9,17 @@
 #include "nsMsgLocalFolderHdrs.h"
 #include "nsNetUtil.h"
 #include "nsMsgOfflineImapOperation.h"
 #include "nsMsgFolderFlags.h"
 #include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgPluggableStore.h"
+#include "nsSimpleEnumerator.h"
 
 using namespace mozilla;
 
 extern LazyLogModule IMAPOffline; // defined in nsMsgOfflineImapOperation.cpp
 
 // scope for all offine ops table
 const char *kOfflineOpsScope = "ns:msg:db:row:scope:ops:all";
 const char *kOfflineOpsTableKind = "ns:msg:db:table:kind:ops";
@@ -303,27 +304,30 @@ NS_IMETHODIMP nsMailDatabase::ListAllOff
 
 // This is used to remember that the db is out of sync with the mail folder
 // and needs to be regenerated.
 void nsMailDatabase::SetReparse(bool reparse)
 {
   m_reparse = reparse;
 }
 
-class nsMsgOfflineOpEnumerator : public nsISimpleEnumerator {
+class nsMsgOfflineOpEnumerator : public nsSimpleEnumerator {
 public:
-  NS_DECL_ISUPPORTS
+  const nsID& DefaultInterface() override
+  {
+    return NS_GET_IID(nsIMsgOfflineImapOperation);
+  }
 
   // nsISimpleEnumerator methods:
   NS_DECL_NSISIMPLEENUMERATOR
 
   nsMsgOfflineOpEnumerator(nsMailDatabase* db);
 
 protected:
-  virtual ~nsMsgOfflineOpEnumerator();
+  ~nsMsgOfflineOpEnumerator() override;
   nsresult GetRowCursor();
   nsresult PrefetchNext();
   nsMailDatabase* mDB;
   nsIMdbTableRowCursor* mRowCursor;
   nsCOMPtr <nsIMsgOfflineImapOperation> mResultOp;
   bool  mDone;
   bool mNextPrefetched;
 };
@@ -336,18 +340,16 @@ nsMsgOfflineOpEnumerator::nsMsgOfflineOp
 }
 
 nsMsgOfflineOpEnumerator::~nsMsgOfflineOpEnumerator()
 {
   NS_IF_RELEASE(mRowCursor);
   NS_RELEASE(mDB);
 }
 
-NS_IMPL_ISUPPORTS(nsMsgOfflineOpEnumerator, nsISimpleEnumerator)
-
 nsresult nsMsgOfflineOpEnumerator::GetRowCursor()
 {
   nsresult rv = NS_OK;
   mDone = false;
 
   if (!mDB || !mDB->m_mdbAllOfflineOpsTable)
     return NS_ERROR_NULL_POINTER;
 
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -33,16 +33,17 @@
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMemory.h"
 #include "nsICollation.h"
 #include "nsCollationCID.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsArrayEnumerator.h"
+#include "nsSimpleEnumerator.h"
 #include "nsIMemoryReporter.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
 #include "mozilla/mailnews/Services.h"
 
 using namespace mozilla::mailnews;
 using namespace mozilla;
 
 #if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_)
@@ -2821,18 +2822,16 @@ void nsMsgDBEnumerator::Clear()
   mRowCursor = nullptr;
   mTable = nullptr;
   mResultHdr = nullptr;
   if (mDB)
     mDB->m_enumerators.RemoveElement(this);
   mDB = nullptr;
 }
 
-NS_IMPL_ISUPPORTS(nsMsgDBEnumerator, nsISimpleEnumerator)
-
 nsresult nsMsgDBEnumerator::GetRowCursor()
 {
   mDone = false;
 
   if (!mDB || !mTable)
     return NS_ERROR_NULL_POINTER;
 
   if (mIterateForwards)
@@ -3159,33 +3158,38 @@ NS_IMETHODIMP nsMsgDatabase::ListAllKeys
         break;
       if (NS_SUCCEEDED(rv))
         aKeys->AppendElement(outOid.mOid_Id);
     }
   }
   return rv;
 }
 
-class nsMsgDBThreadEnumerator : public nsISimpleEnumerator, public nsIDBChangeListener
+class nsMsgDBThreadEnumerator : public nsSimpleEnumerator, nsIDBChangeListener
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_ISUPPORTS_INHERITED
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIMsgThread);
+    }
+
     NS_DECL_NSIDBCHANGELISTENER
 
     // nsMsgDBEnumerator methods:
     typedef nsresult (*nsMsgDBThreadEnumeratorFilter)(nsIMsgThread* thread);
 
     nsMsgDBThreadEnumerator(nsMsgDatabase* db, nsMsgDBThreadEnumeratorFilter filter);
 
 protected:
-    virtual ~nsMsgDBThreadEnumerator();
+    ~nsMsgDBThreadEnumerator() override;
     nsresult          GetTableCursor(void);
     nsresult          PrefetchNext();
     nsMsgDatabase*    mDB;
     nsCOMPtr<nsIMdbPortTableCursor>  mTableCursor;
     RefPtr<nsIMsgThread> mResultThread;
     bool              mDone;
     bool              mNextPrefetched;
     nsMsgDBThreadEnumeratorFilter     mFilter;
@@ -3203,17 +3207,17 @@ nsMsgDBThreadEnumerator::nsMsgDBThreadEn
 nsMsgDBThreadEnumerator::~nsMsgDBThreadEnumerator()
 {
   mTableCursor = nullptr;
   mResultThread = nullptr;
   if (mDB)
     mDB->RemoveListener(this);
 }
 
-NS_IMPL_ISUPPORTS(nsMsgDBThreadEnumerator, nsISimpleEnumerator, nsIDBChangeListener)
+NS_IMPL_ISUPPORTS_INHERITED(nsMsgDBThreadEnumerator, nsSimpleEnumerator, nsIDBChangeListener)
 
 
 /* void OnHdrFlagsChanged (in nsIMsgDBHdr aHdrChanged, in unsigned long aOldFlags, in unsigned long aNewFlags, in nsIDBChangeListener aInstigator); */
 NS_IMETHODIMP nsMsgDBThreadEnumerator::OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, uint32_t aOldFlags, uint32_t aNewFlags, nsIDBChangeListener *aInstigator)
 {
     return NS_OK;
 }
 
--- a/mailnews/db/msgdb/src/nsMsgThread.cpp
+++ b/mailnews/db/msgdb/src/nsMsgThread.cpp
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "msgCore.h"
 #include "nsMsgDatabase.h"
 #include "nsCOMPtr.h"
 #include "nsMsgThread.h"
+#include "nsSimpleEnumerator.h"
 #include "MailNewsTypes2.h"
 #include "mozilla/DebugOnly.h"
 
 NS_IMPL_ISUPPORTS(nsMsgThread, nsIMsgThread)
 
 nsMsgThread::nsMsgThread()
 {
   Init();
@@ -584,37 +585,38 @@ nsresult nsMsgThread::ReparentChildrenOf
 }
 
 NS_IMETHODIMP nsMsgThread::MarkChildRead(bool bRead)
 {
   ChangeUnreadChildCount(bRead ? -1 : 1);
   return NS_OK;
 }
 
-class nsMsgThreadEnumerator : public nsISimpleEnumerator {
+class nsMsgThreadEnumerator : public nsSimpleEnumerator {
 public:
-  NS_DECL_ISUPPORTS
+  const nsID& DefaultInterface() override
+  {
+    return NS_GET_IID(nsIMsgDBHdr);
+  }
 
   // nsISimpleEnumerator methods:
   NS_DECL_NSISIMPLEENUMERATOR
 
   // nsMsgThreadEnumerator methods:
   typedef nsresult (*nsMsgThreadEnumeratorFilter)(nsIMsgDBHdr* hdr, void* closure);
 
   nsMsgThreadEnumerator(nsMsgThread *thread, nsMsgKey startKey,
   nsMsgThreadEnumeratorFilter filter, void* closure);
   int32_t MsgKeyFirstChildIndex(nsMsgKey inMsgKey);
 
 protected:
-  virtual ~nsMsgThreadEnumerator();
-
   nsresult                Prefetch();
 
   nsIMdbTableRowCursor*   mRowCursor;
-  nsCOMPtr<nsIMsgDBHdr>  mResultHdr;
+  nsCOMPtr<nsIMsgDBHdr>   mResultHdr;
   RefPtr<nsMsgThread>     mThread;
   nsMsgKey                mThreadParentKey;
   nsMsgKey                mFirstMsgKey;
   int32_t                 mChildIndex;
   bool                    mDone;
   bool                    mNeedToPrefetch;
   nsMsgThreadEnumeratorFilter     mFilter;
   void*                   mClosure;
@@ -681,22 +683,16 @@ nsMsgThreadEnumerator::nsMsgThreadEnumer
       child->GetThreadParent(&threadParent);
 
       printf("index = %ld key = %ld parent = %lx\n", childIndex, msgKey, threadParent);
     }
   }
 #endif
 }
 
-nsMsgThreadEnumerator::~nsMsgThreadEnumerator()
-{
-}
-
-NS_IMPL_ISUPPORTS(nsMsgThreadEnumerator, nsISimpleEnumerator)
-
 int32_t nsMsgThreadEnumerator::MsgKeyFirstChildIndex(nsMsgKey inMsgKey)
 {
   // if (msgKey != mThreadParentKey)
   //   mDone = true;
   // look through rest of thread looking for a child of this message.
   // If the inMsgKey is the first message in the thread, then all children
   // without parents are considered to be children of inMsgKey.
   // Otherwise, only true children qualify.
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -568,17 +568,17 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFo
     nsCOMPtr<nsISimpleEnumerator> dummy;
     for (int32_t i = 0; i < count; i++)
       mSubFolders[i]->GetSubFolders(getter_AddRefs(dummy));
 
     UpdateSummaryTotals(false);
     if (NS_FAILED(rv)) return rv;
   }
 
-  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
+  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders, NS_GET_IID(nsIMsgFolder)) : NS_ERROR_NULL_POINTER;
 }
 
 //Makes sure the database is open and exists.  If the database is valid then
 //returns NS_OK.  Otherwise returns a failure error value.
 nsresult nsImapMailFolder::GetDatabase()
 {
   nsresult rv = NS_OK;
   if (!mDatabase)
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -250,17 +250,17 @@ nsMsgLocalMailFolder::GetSubFolders(nsIS
         rv = localMailServer->SetFlagsOnDefaultMailboxes();
         if (NS_FAILED(rv))
           return rv;
       }
     }
     UpdateSummaryTotals(false);
   }
 
-  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
+  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders, NS_GET_IID(nsIMsgFolder)) : NS_ERROR_NULL_POINTER;
 }
 
 nsresult nsMsgLocalMailFolder::GetDatabase()
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
   return GetDatabaseWOReparse(getter_AddRefs(msgDB));
 }
 
--- a/mailnews/news/src/nsNewsFolder.cpp
+++ b/mailnews/news/src/nsNewsFolder.cpp
@@ -235,17 +235,17 @@ nsMsgNewsFolder::GetSubFolders(nsISimple
     if (NS_FAILED(rv)) return rv;
 
     // force ourselves to get initialized from cache
     // Don't care if it fails.  this will fail the first time after
     // migration, but we continue on.  see #66018
     (void)UpdateSummaryTotals(false);
   }
 
-  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders) : NS_ERROR_NULL_POINTER;
+  return aResult ? NS_NewArrayEnumerator(aResult, mSubFolders, NS_GET_IID(nsIMsgFolder)) : NS_ERROR_NULL_POINTER;
 }
 
 //Makes sure the database is open and exists.  If the database is valid then
 //returns NS_OK.  Otherwise returns a failure error value.
 nsresult nsMsgNewsFolder::GetDatabase()
 {
   nsresult rv;
   if (!mDatabase)
--- a/rdf/base/nsCompositeDataSource.cpp
+++ b/rdf/base/nsCompositeDataSource.cpp
@@ -31,16 +31,17 @@
 #include "nsIComponentManager.h"
 #include "nsIRDFCompositeDataSource.h"
 #include "nsIRDFNode.h"
 #include "nsIRDFObserver.h"
 #include "nsIRDFRemoteDataSource.h"
 #include "nsTArray.h"
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
+#include "nsSimpleEnumerator.h"
 #include "nsString.h"
 #include "rdf.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "nsEnumeratorUtils.h"
 
 #include "mozilla/Logging.h"
 #include <stdio.h>
@@ -96,37 +97,39 @@ protected:
     friend class CompositeAssertionEnumeratorImpl;
 };
 
 //----------------------------------------------------------------------
 //
 // CompositeEnumeratorImpl
 //
 
-class CompositeEnumeratorImpl : public nsISimpleEnumerator
+class CompositeEnumeratorImpl : public nsSimpleEnumerator
 {
-    // nsISupports
-    NS_DECL_ISUPPORTS
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIRDFNode);
+    }
 
     // nsISimpleEnumerator interface
     NS_DECL_NSISIMPLEENUMERATOR
 
     // pure abstract methods to be overridden
     virtual nsresult
     GetEnumerator(nsIRDFDataSource* aDataSource, nsISimpleEnumerator** aResult) = 0;
 
     virtual nsresult
     HasNegation(nsIRDFDataSource* aDataSource, nsIRDFNode* aNode, bool* aResult) = 0;
 
 protected:
     CompositeEnumeratorImpl(CompositeDataSourceImpl* aCompositeDataSource,
                             bool aAllowNegativeAssertions,
                             bool aCoalesceDuplicateArcs);
 
-    virtual ~CompositeEnumeratorImpl();
+    ~CompositeEnumeratorImpl() override;
 
     CompositeDataSourceImpl* mCompositeDataSource;
 
     nsISimpleEnumerator* mCurrent;
     nsIRDFNode*  mResult;
     int32_t      mNext;
     AutoTArray<nsCOMPtr<nsIRDFNode>, 8>  mAlreadyReturned;
     bool mAllowNegativeAssertions;
@@ -135,35 +138,31 @@ protected:
 
 
 CompositeEnumeratorImpl::CompositeEnumeratorImpl(CompositeDataSourceImpl* aCompositeDataSource,
                                                  bool aAllowNegativeAssertions,
                                                  bool aCoalesceDuplicateArcs)
     : mCompositeDataSource(aCompositeDataSource),
       mCurrent(nullptr),
       mResult(nullptr),
-	  mNext(0),
+      mNext(0),
       mAllowNegativeAssertions(aAllowNegativeAssertions),
       mCoalesceDuplicateArcs(aCoalesceDuplicateArcs)
 {
     NS_ADDREF(mCompositeDataSource);
 }
 
 
 CompositeEnumeratorImpl::~CompositeEnumeratorImpl(void)
 {
     NS_IF_RELEASE(mCurrent);
     NS_IF_RELEASE(mResult);
     NS_RELEASE(mCompositeDataSource);
 }
 
-NS_IMPL_ADDREF(CompositeEnumeratorImpl)
-NS_IMPL_RELEASE(CompositeEnumeratorImpl)
-NS_IMPL_QUERY_INTERFACE(CompositeEnumeratorImpl, nsISimpleEnumerator)
-
 NS_IMETHODIMP
 CompositeEnumeratorImpl::HasMoreElements(bool* aResult)
 {
     NS_ASSERTION(aResult != nullptr, "null ptr");
     if (! aResult)
         return NS_ERROR_NULL_POINTER;
 
     nsresult rv;
--- a/rdf/base/nsContainerEnumerator.cpp
+++ b/rdf/base/nsContainerEnumerator.cpp
@@ -24,46 +24,51 @@
 #include "nsCOMPtr.h"
 #include "nsIRDFContainerUtils.h"
 #include "nsIRDFDataSource.h"
 #include "nsIRDFNode.h"
 #include "nsIRDFService.h"
 #include "nsIServiceManager.h"
 #include "nsRDFCID.h"
 #include "nsString.h"
+#include "nsSimpleEnumerator.h"
 #include "mozilla/Logging.h"
 #include "rdf.h"
 #include "rdfutil.h"
 
 ////////////////////////////////////////////////////////////////////////
 
-class ContainerEnumeratorImpl : public nsISimpleEnumerator {
+class ContainerEnumeratorImpl : public nsSimpleEnumerator {
 private:
     // pseudo-constants
     static nsrefcnt              gRefCnt;
     static nsIRDFResource*       kRDF_nextVal;
     static nsIRDFContainerUtils* gRDFC;
 
     nsCOMPtr<nsIRDFDataSource>      mDataSource;
     nsCOMPtr<nsIRDFResource>        mContainer;
     nsCOMPtr<nsIRDFResource>        mOrdinalProperty;
 
     nsCOMPtr<nsISimpleEnumerator>   mCurrent;
     nsCOMPtr<nsIRDFNode>            mResult;
     int32_t mNextIndex;
 
-    virtual ~ContainerEnumeratorImpl();
+    ~ContainerEnumeratorImpl() override;
 
 public:
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIRDFNode);
+    }
+
+    NS_DECL_NSISIMPLEENUMERATOR
+
     ContainerEnumeratorImpl(nsIRDFDataSource* ds, nsIRDFResource* container);
 
     nsresult Init();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISIMPLEENUMERATOR
 };
 
 nsrefcnt              ContainerEnumeratorImpl::gRefCnt;
 nsIRDFResource*       ContainerEnumeratorImpl::kRDF_nextVal;
 nsIRDFContainerUtils* ContainerEnumeratorImpl::gRDFC;
 
 
 ContainerEnumeratorImpl::ContainerEnumeratorImpl(nsIRDFDataSource* aDataSource,
@@ -102,19 +107,16 @@ ContainerEnumeratorImpl::Init()
 ContainerEnumeratorImpl::~ContainerEnumeratorImpl()
 {
     if (--gRefCnt == 0) {
         NS_IF_RELEASE(kRDF_nextVal);
         NS_IF_RELEASE(gRDFC);
     }
 }
 
-NS_IMPL_ISUPPORTS(ContainerEnumeratorImpl, nsISimpleEnumerator)
-
-
 NS_IMETHODIMP
 ContainerEnumeratorImpl::HasMoreElements(bool* aResult)
 {
     NS_ASSERTION(aResult != nullptr, "null ptr");
     if (! aResult)
         return NS_ERROR_NULL_POINTER;
 
     nsresult rv;
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -33,16 +33,17 @@
 #include "nsIRDFObserver.h"
 #include "nsIRDFInMemoryDataSource.h"
 #include "nsIRDFPropagatableDataSource.h"
 #include "nsIRDFPurgeableDataSource.h"
 #include "nsIRDFService.h"
 #include "nsIServiceManager.h"
 #include "nsCOMArray.h"
 #include "nsEnumeratorUtils.h"
+#include "nsSimpleEnumerator.h"
 #include "nsTArray.h"
 #include "nsCRT.h"
 #include "nsRDFCID.h"
 #include "nsRDFBaseDataSources.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "rdfutil.h"
@@ -345,41 +346,43 @@ mozilla::LazyLogModule InMemoryDataSourc
 //----------------------------------------------------------------------
 //
 // InMemoryAssertionEnumeratorImpl
 //
 
 /**
  * InMemoryAssertionEnumeratorImpl
  */
-class InMemoryAssertionEnumeratorImpl : public nsISimpleEnumerator
+class InMemoryAssertionEnumeratorImpl : public nsSimpleEnumerator
 {
 private:
     InMemoryDataSource* mDataSource;
     nsIRDFResource* mSource;
     nsIRDFResource* mProperty;
     nsIRDFNode*     mTarget;
     nsIRDFNode*     mValue;
     bool            mTruthValue;
     Assertion*      mNextAssertion;
 
-    virtual ~InMemoryAssertionEnumeratorImpl();
+    ~InMemoryAssertionEnumeratorImpl() override;
 
 public:
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIRDFNode);
+    }
+
+    // nsISimpleEnumerator interface
+    NS_DECL_NSISIMPLEENUMERATOR
+
     InMemoryAssertionEnumeratorImpl(InMemoryDataSource* aDataSource,
                                     nsIRDFResource* aSource,
                                     nsIRDFResource* aProperty,
                                     nsIRDFNode* aTarget,
                                     bool aTruthValue);
-
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
-
-    // nsISimpleEnumerator interface
-    NS_DECL_NSISIMPLEENUMERATOR
 };
 
 ////////////////////////////////////////////////////////////////////////
 
 
 InMemoryAssertionEnumeratorImpl::InMemoryAssertionEnumeratorImpl(
                  InMemoryDataSource* aDataSource,
                  nsIRDFResource* aSource,
@@ -431,20 +434,16 @@ InMemoryAssertionEnumeratorImpl::~InMemo
 
     NS_IF_RELEASE(mDataSource);
     NS_IF_RELEASE(mSource);
     NS_IF_RELEASE(mProperty);
     NS_IF_RELEASE(mTarget);
     NS_IF_RELEASE(mValue);
 }
 
-NS_IMPL_ADDREF(InMemoryAssertionEnumeratorImpl)
-NS_IMPL_RELEASE(InMemoryAssertionEnumeratorImpl)
-NS_IMPL_QUERY_INTERFACE(InMemoryAssertionEnumeratorImpl, nsISimpleEnumerator)
-
 NS_IMETHODIMP
 InMemoryAssertionEnumeratorImpl::HasMoreElements(bool* aResult)
 {
     if (mValue) {
         *aResult = true;
         return NS_OK;
     }
 
@@ -512,39 +511,41 @@ InMemoryAssertionEnumeratorImpl::GetNext
 /**
  * This class is a little bit bizarre in that it implements both the
  * <tt>nsIRDFArcsOutCursor</tt> and <tt>nsIRDFArcsInCursor</tt> interfaces.
  * Because the structure of the in-memory graph is pretty flexible, it's
  * fairly easy to parameterize this class. The only funky thing to watch
  * out for is the multiple inheritance clashes.
  */
 
-class InMemoryArcsEnumeratorImpl : public nsISimpleEnumerator
+class InMemoryArcsEnumeratorImpl : public nsSimpleEnumerator
 {
 private:
     InMemoryDataSource* mDataSource;
     nsIRDFResource*     mSource;
     nsIRDFNode*         mTarget;
     AutoTArray<nsCOMPtr<nsIRDFResource>, 8> mAlreadyReturned;
     nsIRDFResource*     mCurrent;
     Assertion*          mAssertion;
     nsCOMArray<nsIRDFNode>* mHashArcs;
 
-    virtual ~InMemoryArcsEnumeratorImpl();
+    ~InMemoryArcsEnumeratorImpl() override;
 
 public:
+    const nsID& DefaultInterface() override
+    {
+      return NS_GET_IID(nsIRDFResource);
+    }
+
+    // nsISimpleEnumerator interface
+    NS_DECL_NSISIMPLEENUMERATOR
+
     InMemoryArcsEnumeratorImpl(InMemoryDataSource* aDataSource,
                                nsIRDFResource* aSource,
                                nsIRDFNode* aTarget);
-
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
-
-    // nsISimpleEnumerator interface
-    NS_DECL_NSISIMPLEENUMERATOR
 };
 
 
 InMemoryArcsEnumeratorImpl::InMemoryArcsEnumeratorImpl(InMemoryDataSource* aDataSource,
                                                        nsIRDFResource* aSource,
                                                        nsIRDFNode* aTarget)
     : mDataSource(aDataSource),
       mSource(aSource),
@@ -586,20 +587,16 @@ InMemoryArcsEnumeratorImpl::~InMemoryArc
 
     NS_RELEASE(mDataSource);
     NS_IF_RELEASE(mSource);
     NS_IF_RELEASE(mTarget);
     NS_IF_RELEASE(mCurrent);
     delete mHashArcs;
 }
 
-NS_IMPL_ADDREF(InMemoryArcsEnumeratorImpl)
-NS_IMPL_RELEASE(InMemoryArcsEnumeratorImpl)
-NS_IMPL_QUERY_INTERFACE(InMemoryArcsEnumeratorImpl, nsISimpleEnumerator)
-
 NS_IMETHODIMP
 InMemoryArcsEnumeratorImpl::HasMoreElements(bool* aResult)
 {
     NS_ASSERTION(aResult != nullptr, "null ptr");
     if (! aResult)
         return NS_ERROR_NULL_POINTER;
 
     if (mCurrent) {