Bug 884061, Part 一: Use NS_DECL_THREADSAFE_ISUPPORTS in comm-central, r=Standard8
authorJoshua Cranmer <Pidgeot18@gmail.com>
Mon, 15 Jul 2013 23:50:16 -0500
changeset 16152 63ae3d6b6984b649228a8a2d5d1586238a4c2ea0
parent 16151 45cc1abe255a26c5c6920c64c4ba257007d47d4a
child 16153 dec0ccb9b6362ade9a363e6788670c841ed5ba10
push id1000
push userbugzilla@standard8.plus.com
push dateMon, 16 Sep 2013 20:21:48 +0000
treeherdercomm-beta@77f0178eb807 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs884061
Bug 884061, Part 一: Use NS_DECL_THREADSAFE_ISUPPORTS in comm-central, r=Standard8
calendar/base/backend/libical/calICSService.cpp
calendar/base/backend/libical/calICSService.h
ldap/xpcom/src/nsLDAPBERValue.cpp
ldap/xpcom/src/nsLDAPBERValue.h
ldap/xpcom/src/nsLDAPConnection.cpp
ldap/xpcom/src/nsLDAPConnection.h
ldap/xpcom/src/nsLDAPMessage.cpp
ldap/xpcom/src/nsLDAPMessage.h
ldap/xpcom/src/nsLDAPModification.cpp
ldap/xpcom/src/nsLDAPModification.h
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPOperation.h
ldap/xpcom/src/nsLDAPServer.cpp
ldap/xpcom/src/nsLDAPServer.h
ldap/xpcom/src/nsLDAPService.cpp
ldap/xpcom/src/nsLDAPService.h
ldap/xpcom/src/nsLDAPSyncQuery.cpp
ldap/xpcom/src/nsLDAPSyncQuery.h
ldap/xpcom/src/nsLDAPURL.cpp
ldap/xpcom/src/nsLDAPURL.h
mailnews/addrbook/src/nsAbBooleanExpression.cpp
mailnews/addrbook/src/nsAbBooleanExpression.h
mailnews/addrbook/src/nsAbContentHandler.cpp
mailnews/addrbook/src/nsAbContentHandler.h
mailnews/addrbook/src/nsAbDirectoryQuery.cpp
mailnews/addrbook/src/nsAbDirectoryQuery.h
mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
mailnews/addrbook/src/nsAbLDAPReplicationData.h
mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
mailnews/addrbook/src/nsAbLDAPReplicationQuery.h
mailnews/addrbook/src/nsAbManager.cpp
mailnews/addrbook/src/nsAbManager.h
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/addrbook/src/nsAddrDatabase.h
mailnews/base/src/nsCopyMessageStreamListener.cpp
mailnews/base/src/nsCopyMessageStreamListener.h
mailnews/base/src/nsMessengerBootstrap.cpp
mailnews/base/src/nsMessengerBootstrap.h
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/base/src/nsMsgAccountManager.h
mailnews/base/src/nsMsgCopyService.cpp
mailnews/base/src/nsMsgCopyService.h
mailnews/base/src/nsMsgMailSession.cpp
mailnews/base/src/nsMsgMailSession.h
mailnews/base/src/nsMsgOfflineManager.cpp
mailnews/base/src/nsMsgOfflineManager.h
mailnews/base/src/nsMsgProgress.cpp
mailnews/base/src/nsMsgProgress.h
mailnews/base/src/nsMsgStatusFeedback.cpp
mailnews/base/src/nsMsgStatusFeedback.h
mailnews/base/src/nsMsgWindow.cpp
mailnews/base/src/nsMsgWindow.h
mailnews/base/src/nsSubscribableServer.cpp
mailnews/base/src/nsSubscribableServer.h
mailnews/base/src/nsSubscribeDataSource.cpp
mailnews/base/src/nsSubscribeDataSource.h
mailnews/base/util/nsMsgCompressIStream.cpp
mailnews/base/util/nsMsgCompressIStream.h
mailnews/base/util/nsMsgCompressOStream.cpp
mailnews/base/util/nsMsgCompressOStream.h
mailnews/base/util/nsMsgIdentity.cpp
mailnews/base/util/nsMsgIdentity.h
mailnews/base/util/nsMsgIncomingServer.cpp
mailnews/base/util/nsMsgIncomingServer.h
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgMailNewsUrl.h
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgProtocol.h
mailnews/base/util/nsMsgTxn.cpp
mailnews/base/util/nsMsgTxn.h
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsMsgCompFields.cpp
mailnews/compose/src/nsMsgCompFields.h
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgCompose.h
mailnews/compose/src/nsMsgCopy.cpp
mailnews/compose/src/nsMsgCopy.h
mailnews/compose/src/nsMsgQuote.cpp
mailnews/compose/src/nsMsgQuote.h
mailnews/compose/src/nsMsgSend.cpp
mailnews/compose/src/nsMsgSend.h
mailnews/imap/src/nsIMAPBodyShell.cpp
mailnews/imap/src/nsIMAPBodyShell.h
mailnews/imap/src/nsIMAPHostSessionList.cpp
mailnews/imap/src/nsIMAPHostSessionList.h
mailnews/imap/src/nsImapFlagAndUidState.cpp
mailnews/imap/src/nsImapFlagAndUidState.h
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapMailFolder.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapService.h
mailnews/imap/src/nsImapUtils.cpp
mailnews/imap/src/nsImapUtils.h
mailnews/imap/src/nsSyncRunnableHelpers.cpp
mailnews/imap/src/nsSyncRunnableHelpers.h
mailnews/import/applemail/src/nsAppleMailImport.cpp
mailnews/import/applemail/src/nsAppleMailImport.h
mailnews/import/eudora/src/nsEudoraCompose.cpp
mailnews/import/eudora/src/nsEudoraImport.cpp
mailnews/import/oexpress/nsOEImport.cpp
mailnews/import/outlook/src/nsOutlookCompose.cpp
mailnews/import/outlook/src/nsOutlookImport.cpp
mailnews/import/src/nsImportABDescriptor.cpp
mailnews/import/src/nsImportABDescriptor.h
mailnews/import/src/nsImportAddressBooks.cpp
mailnews/import/src/nsImportFieldMap.cpp
mailnews/import/src/nsImportFieldMap.h
mailnews/import/src/nsImportMail.cpp
mailnews/import/src/nsImportMailboxDescriptor.cpp
mailnews/import/src/nsImportMailboxDescriptor.h
mailnews/import/src/nsImportService.cpp
mailnews/import/src/nsImportService.h
mailnews/import/text/src/nsTextImport.cpp
mailnews/import/vcard/src/nsVCardImport.cpp
mailnews/import/winlivemail/nsWMImport.cpp
mailnews/local/src/nsPop3Sink.cpp
mailnews/local/src/nsPop3Sink.h
mailnews/mapi/mapihook/src/msgMapiHook.cpp
mailnews/mapi/mapihook/src/msgMapiSupport.cpp
mailnews/mapi/mapihook/src/msgMapiSupport.h
mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.h
mailnews/mime/emitters/nsMimeBaseEmitter.cpp
mailnews/mime/emitters/nsMimeBaseEmitter.h
mailnews/mime/src/mimecms.cpp
mailnews/mime/src/nsMimeConverter.cpp
mailnews/mime/src/nsMimeConverter.h
mailnews/mime/src/nsStreamConverter.cpp
mailnews/mime/src/nsStreamConverter.h
mailnews/news/src/nsNntpMockChannel.cpp
mailnews/news/src/nsNntpMockChannel.h
mailnews/news/src/nsNntpService.cpp
mailnews/news/src/nsNntpService.h
--- a/calendar/base/backend/libical/calICSService.cpp
+++ b/calendar/base/backend/libical/calICSService.cpp
@@ -847,17 +847,17 @@ calIcalComponent::Get##Attrname(calIDura
     *dtp = new calDuration(&idt);                                       \
     CAL_ENSURE_MEMORY(*dtp);                                            \
     NS_ADDREF(*dtp);                                                    \
     return NS_OK;                                                       \
 }
 
 
 NS_IMPL_CLASSINFO(calIcalComponent, NULL, nsIClassInfo::THREADSAFE, CAL_ICALCOMPONENT_CID)
-NS_IMPL_THREADSAFE_ISUPPORTS2(calIcalComponent, calIIcalComponent, nsIClassInfo)
+NS_IMPL_ISUPPORTS2(calIcalComponent, calIIcalComponent, nsIClassInfo)
 NS_IMPL_CI_INTERFACE_GETTER1(calIcalComponent, calIIcalComponent)
 NS_IMPL_THREADSAFE_CI(calIcalComponent)
 
 NS_IMETHODIMP_(icalcomponent *)
 calIcalComponent::GetLibicalComponent()
 {
     return mComponent;
 }
@@ -1232,17 +1232,17 @@ calIcalComponent::AddProperty(calIIcalPr
 //     // XXX like AddSubcomponent, this is questionable
 //     calIcalProperty *ical = static_cast<calIcalProperty *>(prop);
 //     icalcomponent_remove_property(mComponent, ical->mProperty);
 //     ical->mParent = nullptr;
 //     return NS_OK;
 // }
 
 NS_IMPL_CLASSINFO(calICSService, NULL, nsIClassInfo::THREADSAFE, CAL_ICSSERVICE_CID)
-NS_IMPL_THREADSAFE_ISUPPORTS2(calICSService, calIICSService, nsIClassInfo)
+NS_IMPL_ISUPPORTS2(calICSService, calIICSService, nsIClassInfo)
 NS_IMPL_CI_INTERFACE_GETTER1(calICSService, calIICSService)
 NS_IMPL_THREADSAFE_CI(calICSService)
 
 calICSService::calICSService()
 {
 }
 
 NS_IMETHODIMP
--- a/calendar/base/backend/libical/calICSService.h
+++ b/calendar/base/backend/libical/calICSService.h
@@ -60,17 +60,17 @@ protected:
         nsMainThreadPtrHandle<calIIcsComponentParsingListener> mListener;
         nsCOMPtr<calIIcalComponent> mComp;
         nsresult mStatus;
       };
     };
 public:
     calICSService();
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICLASSINFO
     NS_DECL_CALIICSSERVICE
 };
 
 class calIcalComponent;
 
 class calIcalProperty : public calIIcalProperty,
                         public cal::XpcomBase
@@ -110,17 +110,17 @@ public:
         mReferencedTimezones.Init();
     }
 
     // VTIMEZONE ctor
     calIcalComponent(icaltimezone * icaltz, icalcomponent * ical) : mComponent(ical), mTimezone(icaltz) {
         mReferencedTimezones.Init();
     }
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICLASSINFO
     NS_DECL_CALIICALCOMPONENT
 
 protected:
     virtual ~calIcalComponent();
 
     calITimezoneProvider * getTzProvider() const {
         // walk up the parents to find a tz provider:
--- a/ldap/xpcom/src/nsLDAPBERValue.cpp
+++ b/ldap/xpcom/src/nsLDAPBERValue.cpp
@@ -3,17 +3,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 "nsLDAPBERValue.h"
 #include "nsMemory.h"
 #include "nsStringGlue.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPBERValue, nsILDAPBERValue)
+NS_IMPL_ISUPPORTS1(nsLDAPBERValue, nsILDAPBERValue)
 
 nsLDAPBERValue::nsLDAPBERValue() : mValue(0), mSize(0)
 {
 }
 
 nsLDAPBERValue::~nsLDAPBERValue()
 {
     if (mValue) {
--- a/ldap/xpcom/src/nsLDAPBERValue.h
+++ b/ldap/xpcom/src/nsLDAPBERValue.h
@@ -14,17 +14,17 @@
 //
 #define NS_LDAPBERVALUE_CID \
 { 0x7c9fa10e, 0x1dd2, 0x11b2, \
   {0xa0, 0x97, 0xac, 0x37, 0x9e, 0x68, 0x03, 0xb2 }}
 
 class nsLDAPBERValue : public nsILDAPBERValue
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPBERVALUE
 
     nsLDAPBERValue();
     virtual ~nsLDAPBERValue();
     
 protected:
 
     /** 
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -45,18 +45,18 @@ nsLDAPConnection::~nsLDAPConnection()
 {
   nsCOMPtr<nsIObserverService> obsServ =
       do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
   if (obsServ)
       obsServ->RemoveObserver(this, "profile-change-net-teardown");
   Close();
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsLDAPConnection)
-NS_IMPL_THREADSAFE_RELEASE(nsLDAPConnection)
+NS_IMPL_ADDREF(nsLDAPConnection)
+NS_IMPL_RELEASE(nsLDAPConnection)
 NS_IMPL_CLASSINFO(nsLDAPConnection, NULL, nsIClassInfo::THREADSAFE,
                   NS_LDAPCONNECTION_CID)
 
 NS_INTERFACE_MAP_BEGIN(nsLDAPConnection)
   NS_INTERFACE_MAP_ENTRY(nsILDAPConnection)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsIDNSListener)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
@@ -602,17 +602,17 @@ nsLDAPConnectionRunnable::nsLDAPConnecti
   : mOperationID(aOperationID),  mConnection(aConnection)
 {
 }
 
 nsLDAPConnectionRunnable::~nsLDAPConnectionRunnable()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPConnectionRunnable, nsIRunnable)
+NS_IMPL_ISUPPORTS1(nsLDAPConnectionRunnable, nsIRunnable)
 
 NS_IMETHODIMP nsLDAPConnectionRunnable::Run()
 {
   if (!mOperationID) {
     NS_ERROR("mOperationID is null");
     return NS_ERROR_NULL_POINTER;
   }
 
--- a/ldap/xpcom/src/nsLDAPConnection.h
+++ b/ldap/xpcom/src/nsLDAPConnection.h
@@ -37,17 +37,17 @@ class nsLDAPConnection : public nsILDAPC
                          public nsIObserver
 
 {
     friend class nsLDAPOperation;
     friend class nsLDAPMessage;
     friend class nsLDAPConnectionRunnable;
 
   public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPCONNECTION
     NS_DECL_NSIDNSLISTENER
     NS_DECL_NSIOBSERVER
 
     // constructor & destructor
     //
     nsLDAPConnection();
     virtual ~nsLDAPConnection();
@@ -109,16 +109,16 @@ class nsLDAPConnectionRunnable : public 
   friend class nsLDAPMessage;
 
 public:
   nsLDAPConnectionRunnable(int32_t aOperationID,
                            nsILDAPOperation *aOperation,
                            nsLDAPConnection *aConnection);
   virtual ~nsLDAPConnectionRunnable();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   int32_t mOperationID;
   nsRefPtr<nsLDAPConnection> mConnection;
 };
 
 #endif // _nsLDAPConnection_h_
--- a/ldap/xpcom/src/nsLDAPMessage.cpp
+++ b/ldap/xpcom/src/nsLDAPMessage.cpp
@@ -14,18 +14,18 @@
 #include "nsLDAPBERValue.h"
 #include "nsILDAPErrors.h"
 #include "nsIClassInfoImpl.h"
 #include "nsLDAPUtils.h"
 
 NS_IMPL_CLASSINFO(nsLDAPMessage, NULL, nsIClassInfo::THREADSAFE,
                   NS_LDAPMESSAGE_CID)
 
-NS_IMPL_THREADSAFE_ADDREF(nsLDAPMessage)
-NS_IMPL_THREADSAFE_RELEASE(nsLDAPMessage)
+NS_IMPL_ADDREF(nsLDAPMessage)
+NS_IMPL_RELEASE(nsLDAPMessage)
 NS_INTERFACE_MAP_BEGIN(nsLDAPMessage)
   NS_INTERFACE_MAP_ENTRY(nsILDAPMessage)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsILDAPMessage)
   NS_IMPL_QUERY_CLASSINFO(nsLDAPMessage)
 NS_INTERFACE_MAP_END_THREADSAFE
 NS_IMPL_CI_INTERFACE_GETTER1(nsLDAPMessage, nsILDAPMessage)
 
 
--- a/ldap/xpcom/src/nsLDAPMessage.h
+++ b/ldap/xpcom/src/nsLDAPMessage.h
@@ -22,17 +22,17 @@ class nsLDAPMessage : public nsILDAPMess
 {
     friend class nsLDAPOperation;
     friend class nsLDAPConnection;
     friend class nsLDAPConnectionRunnable;
     friend class nsOnLDAPMessageRunnable;
 
   public:
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPMESSAGE
 
     // constructor & destructor
     //
     nsLDAPMessage();
     virtual ~nsLDAPMessage();
 
   protected:
--- a/ldap/xpcom/src/nsLDAPModification.cpp
+++ b/ldap/xpcom/src/nsLDAPModification.cpp
@@ -6,17 +6,17 @@
 #include "nsLDAPModification.h"
 #include "nsILDAPBERValue.h"
 #include "nsISimpleEnumerator.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 
 using namespace mozilla;
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPModification, nsILDAPModification)
+NS_IMPL_ISUPPORTS1(nsLDAPModification, nsILDAPModification)
 
 // constructor
 //
 nsLDAPModification::nsLDAPModification()
     : mValuesLock("nsLDAPModification.mValuesLock")
 {
 }
 
--- a/ldap/xpcom/src/nsLDAPModification.h
+++ b/ldap/xpcom/src/nsLDAPModification.h
@@ -16,17 +16,17 @@
 //
 #define NS_LDAPMODIFICATION_CID \
 { 0x5b0f4d00, 0x062e, 0x11d6, \
   { 0xa7, 0xf2, 0xfc, 0x94, 0x3c, 0x3c, 0x03, 0x9c }}
 
 class nsLDAPModification : public nsILDAPModification
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSILDAPMODIFICATION
 
   // constructor & destructor
   //
   nsLDAPModification();
   virtual ~nsLDAPModification();
 
   nsresult Init();
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -64,18 +64,18 @@ nsLDAPOperation::nsLDAPOperation()
 // destructor
 nsLDAPOperation::~nsLDAPOperation()
 {
 }
 
 NS_IMPL_CLASSINFO(nsLDAPOperation, NULL, nsIClassInfo::THREADSAFE,
                   NS_LDAPOPERATION_CID)
 
-NS_IMPL_THREADSAFE_ADDREF(nsLDAPOperation)
-NS_IMPL_THREADSAFE_RELEASE(nsLDAPOperation)
+NS_IMPL_ADDREF(nsLDAPOperation)
+NS_IMPL_RELEASE(nsLDAPOperation)
 NS_INTERFACE_MAP_BEGIN(nsLDAPOperation)
   NS_INTERFACE_MAP_ENTRY(nsILDAPOperation)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsILDAPOperation)
   NS_IMPL_QUERY_CLASSINFO(nsLDAPOperation)
 NS_INTERFACE_MAP_END_THREADSAFE
 NS_IMPL_CI_INTERFACE_GETTER1(nsLDAPOperation, nsILDAPOperation)
 
 /**
--- a/ldap/xpcom/src/nsLDAPOperation.h
+++ b/ldap/xpcom/src/nsLDAPOperation.h
@@ -20,17 +20,17 @@
 #define NS_LDAPOPERATION_CID \
 { 0x97a479d0, 0x9a44, 0x47c6, \
   { 0xa1, 0x7a, 0x87, 0xf9, 0xb0, 0x02, 0x94, 0xbb}}
 
 class nsLDAPOperation : public nsILDAPOperation
 {
   public:
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPOPERATION
 
     // constructor & destructor
     //
     nsLDAPOperation();
     virtual ~nsLDAPOperation();
 
     /**
--- a/ldap/xpcom/src/nsLDAPServer.cpp
+++ b/ldap/xpcom/src/nsLDAPServer.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 
  * 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 "nsLDAPServer.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPServer, nsILDAPServer)
+NS_IMPL_ISUPPORTS1(nsLDAPServer, nsILDAPServer)
 
 nsLDAPServer::nsLDAPServer()
     : mSizeLimit(0),
       mProtocolVersion(nsILDAPConnection::VERSION3)
 {
 }
 
 nsLDAPServer::~nsLDAPServer()
--- a/ldap/xpcom/src/nsLDAPServer.h
+++ b/ldap/xpcom/src/nsLDAPServer.h
@@ -12,17 +12,17 @@
 // 8bbbaa54-f316-4271-87c3-d52b5b1c1f5b
 #define NS_LDAPSERVER_CID \
 { 0x8bbbaa54, 0xf316, 0x4271, \
   { 0x87, 0xc3, 0xd5, 0x2b, 0x5b, 0x1c, 0x1f, 0x5b}}
 
 class nsLDAPServer : public nsILDAPServer
 {
   public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPSERVER
 
     // Constructor & destructor
     //
     nsLDAPServer();
     virtual ~nsLDAPServer();
 
   protected:
--- a/ldap/xpcom/src/nsLDAPService.cpp
+++ b/ldap/xpcom/src/nsLDAPService.cpp
@@ -162,17 +162,17 @@ bool nsLDAPServiceEntry::DeleteEntry()
 
     return true;
 }
 // This is the end of the nsLDAPServiceEntry class
 
 
 // Here begins the implementation for nsLDAPService
 // 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsLDAPService,
+NS_IMPL_ISUPPORTS2(nsLDAPService,
                               nsILDAPService,
                               nsILDAPMessageListener)
 
 
 // constructor
 //
 nsLDAPService::nsLDAPService()
     : mLock("nsLDAPService.mLock")
--- a/ldap/xpcom/src/nsLDAPService.h
+++ b/ldap/xpcom/src/nsLDAPService.h
@@ -75,17 +75,17 @@ class nsLDAPServiceEntry
 
 // This is the interface we're implementing.
 //
 class nsLDAPService : public nsILDAPService, public nsILDAPMessageListener
 {
   public: 
     // interface decls
     //
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPSERVICE
     NS_DECL_NSILDAPMESSAGELISTENER
 
     // constructor and destructor
     //
     nsLDAPService();
     virtual ~nsLDAPService();
     
--- a/ldap/xpcom/src/nsLDAPSyncQuery.cpp
+++ b/ldap/xpcom/src/nsLDAPSyncQuery.cpp
@@ -9,17 +9,17 @@
 #include "nsThreadUtils.h"
 #include "nsILDAPMessage.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMemory.h"
 
 // nsISupports Implementation
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsLDAPSyncQuery, nsILDAPSyncQuery, nsILDAPMessageListener)
+NS_IMPL_ISUPPORTS2(nsLDAPSyncQuery, nsILDAPSyncQuery, nsILDAPMessageListener)
 
 // Constructor
 //
 nsLDAPSyncQuery::nsLDAPSyncQuery() :
     mFinished(false), // This is a control variable for event loop
     mProtocolVersion(nsILDAPConnection::VERSION3)
 {
 }
--- a/ldap/xpcom/src/nsLDAPSyncQuery.h
+++ b/ldap/xpcom/src/nsLDAPSyncQuery.h
@@ -18,17 +18,17 @@
 
 
 class nsLDAPSyncQuery : public nsILDAPSyncQuery,
                         public nsILDAPMessageListener
 
 {
   public:
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSILDAPMESSAGELISTENER
     NS_DECL_NSILDAPSYNCQUERY
 
     nsLDAPSyncQuery();
     virtual ~nsLDAPSyncQuery();
 
   protected:
 
--- a/ldap/xpcom/src/nsLDAPURL.cpp
+++ b/ldap/xpcom/src/nsLDAPURL.cpp
@@ -13,17 +13,17 @@
 #include "nsIStandardURL.h"
 #include "nsMsgUtils.h"
 
 // The two schemes we support, LDAP and LDAPS
 //
 NS_NAMED_LITERAL_CSTRING(LDAP_SCHEME, "ldap");
 NS_NAMED_LITERAL_CSTRING(LDAP_SSL_SCHEME, "ldaps");
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsLDAPURL, nsILDAPURL, nsIURI)
+NS_IMPL_ISUPPORTS2(nsLDAPURL, nsILDAPURL, nsIURI)
 
 nsLDAPURL::nsLDAPURL()
     : mScope(SCOPE_BASE),
       mOptions(0)
 {
 }
 
 nsLDAPURL::~nsLDAPURL()
--- a/ldap/xpcom/src/nsLDAPURL.h
+++ b/ldap/xpcom/src/nsLDAPURL.h
@@ -27,17 +27,17 @@
  * URI locally (to allow convenient get/set), but always updates the mBaseURL
  * when one changes to ensure that mBaseURL.spec and the local data are kept
  * consistent.
  */
 
 class nsLDAPURL : public nsILDAPURL
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIURI
   NS_DECL_NSILDAPURL
 
   nsLDAPURL();
   virtual ~nsLDAPURL();
 
 protected:
 
--- a/mailnews/addrbook/src/nsAbBooleanExpression.cpp
+++ b/mailnews/addrbook/src/nsAbBooleanExpression.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsAbBooleanExpression.h"
 #include "nsComponentManagerUtils.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbBooleanConditionString, nsIAbBooleanConditionString)
+NS_IMPL_ISUPPORTS1(nsAbBooleanConditionString, nsIAbBooleanConditionString)
 
 nsAbBooleanConditionString::nsAbBooleanConditionString() :
     mCondition (nsIAbBooleanConditionTypes::Exists)
 {
 }
 
 nsAbBooleanConditionString::~nsAbBooleanConditionString()
 {
@@ -70,17 +70,17 @@ NS_IMETHODIMP nsAbBooleanConditionString
     if (!aValue)
         return NS_ERROR_NULL_POINTER;
 
     mValue = aValue;
 
     return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbBooleanExpression, nsIAbBooleanExpression)
+NS_IMPL_ISUPPORTS1(nsAbBooleanExpression, nsIAbBooleanExpression)
 
 nsAbBooleanExpression::nsAbBooleanExpression() :
     mOperation (nsIAbBooleanOperationTypes::AND)
 {
 }
 
 nsAbBooleanExpression::~nsAbBooleanExpression()
 {
--- a/mailnews/addrbook/src/nsAbBooleanExpression.h
+++ b/mailnews/addrbook/src/nsAbBooleanExpression.h
@@ -9,32 +9,32 @@
 #include "nsIAbBooleanExpression.h"
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
 #include "nsIArray.h"
 
 class nsAbBooleanConditionString : public nsIAbBooleanConditionString
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIABBOOLEANCONDITIONSTRING
 
     nsAbBooleanConditionString();
     virtual ~nsAbBooleanConditionString();
 
 protected:
     nsAbBooleanConditionType mCondition;
     nsCString mName;
     nsString mValue;
 };
 
 class nsAbBooleanExpression: public nsIAbBooleanExpression
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIABBOOLEANEXPRESSION
 
     nsAbBooleanExpression();
     virtual ~nsAbBooleanExpression();
 
 protected:
     nsAbBooleanOperationType mOperation;
     nsCOMPtr<nsIArray> mExpressions;
--- a/mailnews/addrbook/src/nsAbContentHandler.cpp
+++ b/mailnews/addrbook/src/nsAbContentHandler.cpp
@@ -23,22 +23,18 @@
 nsAbContentHandler::nsAbContentHandler()
 {
 }
 
 nsAbContentHandler::~nsAbContentHandler()
 {
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsAbContentHandler)
-NS_IMPL_THREADSAFE_RELEASE(nsAbContentHandler)
-
-NS_IMPL_QUERY_INTERFACE2(nsAbContentHandler,
-                         nsIContentHandler,
-                         nsIStreamLoaderObserver)
+NS_IMPL_ISUPPORTS2(nsAbContentHandler, nsIContentHandler,
+  nsIStreamLoaderObserver)
 
 NS_IMETHODIMP
 nsAbContentHandler::HandleContent(const char *aContentType,
                                   nsIInterfaceRequestor *aWindowContext,
                                   nsIRequest *request)
 {
   NS_ENSURE_ARG_POINTER(request);
 
--- a/mailnews/addrbook/src/nsAbContentHandler.h
+++ b/mailnews/addrbook/src/nsAbContentHandler.h
@@ -11,14 +11,14 @@
 
 class nsAbContentHandler : public nsIContentHandler,
                            public nsIStreamLoaderObserver
 {
 public:
   nsAbContentHandler();
   virtual ~nsAbContentHandler();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSICONTENTHANDLER
   NS_DECL_NSISTREAMLOADEROBSERVER
 };
 
 #endif
--- a/mailnews/addrbook/src/nsAbDirectoryQuery.cpp
+++ b/mailnews/addrbook/src/nsAbDirectoryQuery.cpp
@@ -10,17 +10,17 @@
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsStringGlue.h"
 #include "nsUnicharUtils.h"
 #include "nsIAbDirSearchListener.h"
 #include "nsISimpleEnumerator.h"
 #include "nsMsgUtils.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbDirectoryQuerySimpleBooleanExpression, nsIAbBooleanExpression)
+NS_IMPL_ISUPPORTS1(nsAbDirectoryQuerySimpleBooleanExpression, nsIAbBooleanExpression)
 
 nsAbDirectoryQuerySimpleBooleanExpression::nsAbDirectoryQuerySimpleBooleanExpression() :
     mOperation (nsIAbBooleanOperationTypes::AND)
 {
 }
 
 nsAbDirectoryQuerySimpleBooleanExpression::~nsAbDirectoryQuerySimpleBooleanExpression()
 {
@@ -85,17 +85,17 @@ NS_IMETHODIMP nsAbDirectoryQuerySimpleBo
   }
 
   // Values ok, so we can just save and return.
   mExpressions = aExpressions;
 
   return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbDirectoryQueryArguments, nsIAbDirectoryQueryArguments)
+NS_IMPL_ISUPPORTS1(nsAbDirectoryQueryArguments, nsIAbDirectoryQueryArguments)
 
 nsAbDirectoryQueryArguments::nsAbDirectoryQueryArguments() :
     mQuerySubDirectories(true)
 {
 }
 
 nsAbDirectoryQueryArguments::~nsAbDirectoryQueryArguments()
 {
@@ -152,17 +152,17 @@ NS_IMETHODIMP nsAbDirectoryQueryArgument
 }
 
 NS_IMETHODIMP nsAbDirectoryQueryArguments::SetFilter(const nsACString & aFilter)
 {
     mFilter.Assign(aFilter);
     return NS_OK;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbDirectoryQueryPropertyValue, nsIAbDirectoryQueryPropertyValue)
+NS_IMPL_ISUPPORTS1(nsAbDirectoryQueryPropertyValue, nsIAbDirectoryQueryPropertyValue)
 
 nsAbDirectoryQueryPropertyValue::nsAbDirectoryQueryPropertyValue()
 {
 }
 
 nsAbDirectoryQueryPropertyValue::nsAbDirectoryQueryPropertyValue(const char* aName,
       const PRUnichar* aValue)
 {
--- a/mailnews/addrbook/src/nsAbDirectoryQuery.h
+++ b/mailnews/addrbook/src/nsAbDirectoryQuery.h
@@ -11,49 +11,49 @@
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
 #include "nsIArray.h"
 #include "nsIAbBooleanExpression.h"
 
 class nsAbDirectoryQuerySimpleBooleanExpression : public nsIAbBooleanExpression
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIABBOOLEANEXPRESSION
 
     nsAbDirectoryQuerySimpleBooleanExpression();
     virtual ~nsAbDirectoryQuerySimpleBooleanExpression();
 
 public:
     nsCOMPtr<nsIArray> mExpressions;
     nsAbBooleanOperationType mOperation;
 };
 
 
 class nsAbDirectoryQueryArguments : public nsIAbDirectoryQueryArguments
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIABDIRECTORYQUERYARGUMENTS
 
     nsAbDirectoryQueryArguments();
     virtual ~nsAbDirectoryQueryArguments();
 
 protected:
     nsCOMPtr<nsISupports> mExpression;
     nsCOMPtr<nsISupports> mTypeSpecificArg;
     bool mQuerySubDirectories;
     nsCString mFilter;
 };
 
 
 class nsAbDirectoryQueryPropertyValue : public nsIAbDirectoryQueryPropertyValue
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIABDIRECTORYQUERYPROPERTYVALUE
 
     nsAbDirectoryQueryPropertyValue();
     nsAbDirectoryQueryPropertyValue(const char* aName,
           const PRUnichar* aValue);
     nsAbDirectoryQueryPropertyValue(const char* aName,
           nsISupports* aValueISupports);
     virtual ~nsAbDirectoryQueryPropertyValue();
--- a/mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
@@ -16,17 +16,17 @@
 
 #include <stdio.h>
 
 using namespace mozilla;
 
 class nsAbModifyLDAPMessageListener : public nsAbLDAPListenerBase
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   nsAbModifyLDAPMessageListener(const int32_t type,
                                 const nsACString &cardDN,
                                 nsIArray* modArray,
                                 const nsACString &newRDN,
                                 const nsACString &newBaseDN,
                                 nsILDAPURL* directoryUrl,
                                 nsILDAPConnection* connection,
@@ -58,17 +58,17 @@ protected:
   bool mFlagRename;
 
   nsCOMPtr<nsILDAPOperation> mModifyOperation;
   nsCOMPtr<nsIMutableArray> mServerSearchControls;
   nsCOMPtr<nsIMutableArray> mClientSearchControls;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbModifyLDAPMessageListener, nsILDAPMessageListener)
+NS_IMPL_ISUPPORTS1(nsAbModifyLDAPMessageListener, nsILDAPMessageListener)
 
 nsAbModifyLDAPMessageListener::nsAbModifyLDAPMessageListener(
     const int32_t type,
     const nsACString &cardDN,
     nsIArray* modArray,
     const nsACString &newRDN,
     const nsACString &newBaseDN,
     nsILDAPURL* directoryUrl,
--- a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
@@ -22,17 +22,17 @@
 #include "nsXPCOMCIDInternal.h"
 
 using namespace mozilla;
 
 // nsAbLDAPListenerBase inherits nsILDAPMessageListener
 class nsAbQueryLDAPMessageListener : public nsAbLDAPListenerBase
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // Note that the directoryUrl is the details of the ldap directory
   // without any search params or return attributes specified. The searchUrl
   // therefore has the search params and return attributes specified.
   //  nsAbQueryLDAPMessageListener(nsIAbDirectoryQuery* directoryQuery,
   nsAbQueryLDAPMessageListener(nsIAbDirectoryQueryResultListener* resultListener,
                                nsILDAPURL* directoryUrl,
                                nsILDAPURL* searchUrl,
@@ -69,17 +69,17 @@ protected:
   bool mCanceled;
   bool mWaitingForPrevQueryToFinish;
 
   nsCOMPtr<nsIMutableArray> mServerSearchControls;
   nsCOMPtr<nsIMutableArray> mClientSearchControls;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbQueryLDAPMessageListener, nsILDAPMessageListener)
+NS_IMPL_ISUPPORTS1(nsAbQueryLDAPMessageListener, nsILDAPMessageListener)
 
 nsAbQueryLDAPMessageListener::nsAbQueryLDAPMessageListener(
         nsIAbDirectoryQueryResultListener *resultListener,
         nsILDAPURL* directoryUrl,
         nsILDAPURL* searchUrl,
         nsILDAPConnection* connection,
         nsIAbDirectoryQueryArguments* queryArguments,
         nsIMutableArray* serverSearchControls,
@@ -286,17 +286,17 @@ nsresult nsAbQueryLDAPMessageListener::O
       nsIAbDirectoryQueryResultListener::queryResultComplete, 0);
 
   return mResultListener->OnQueryResult(
       nsIAbDirectoryQueryResultListener::queryResultError, errorCode);
 }
 
 // nsAbLDAPDirectoryQuery
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsAbLDAPDirectoryQuery, nsIAbDirectoryQuery,
+NS_IMPL_ISUPPORTS2(nsAbLDAPDirectoryQuery, nsIAbDirectoryQuery,
                               nsIAbDirectoryQueryResultListener)
 
 nsAbLDAPDirectoryQuery::nsAbLDAPDirectoryQuery() :
     mInitialized(false)
 {
 }
 
 nsAbLDAPDirectoryQuery::~nsAbLDAPDirectoryQuery()
--- a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
+++ b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h
@@ -14,17 +14,17 @@
 
 #include "nsStringGlue.h"
 #include "nsCOMArray.h"
 
 class nsAbLDAPDirectoryQuery : public nsIAbDirectoryQuery,
                              public nsIAbDirectoryQueryResultListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIABDIRECTORYQUERY
   NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER
 
   nsAbLDAPDirectoryQuery();
   virtual ~nsAbLDAPDirectoryQuery();
 
 protected:
   nsCOMPtr<nsILDAPMessageListener> mListener;
--- a/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
@@ -11,17 +11,17 @@
 #include "nsAbLDAPReplicationQuery.h"
 #include "nsILDAPErrors.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
 
 // once bug # 101252 gets fixed, this should be reverted back to be non threadsafe
 // implementation is not really thread safe since each object should exist 
 // independently along with its related independent nsAbLDAPReplicationQuery object.
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsAbLDAPProcessReplicationData, nsIAbLDAPProcessReplicationData, nsILDAPMessageListener)
+NS_IMPL_ISUPPORTS2(nsAbLDAPProcessReplicationData, nsIAbLDAPProcessReplicationData, nsILDAPMessageListener)
 
 nsAbLDAPProcessReplicationData::nsAbLDAPProcessReplicationData() :
   nsAbLDAPListenerBase(),
   mState(kIdle),
   mProtocol(-1),
   mCount(0),
   mDBOpen(false),
   mInitialized(false)
--- a/mailnews/addrbook/src/nsAbLDAPReplicationData.h
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationData.h
@@ -17,17 +17,17 @@
 #include "nsIAbLDAPAttributeMap.h"
 #include "nsIAbLDAPDirectory.h"
 #include "nsStringGlue.h"
 
 class nsAbLDAPProcessReplicationData : public nsIAbLDAPProcessReplicationData,
                                        public nsAbLDAPListenerBase
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIABLDAPPROCESSREPLICATIONDATA
 
   nsAbLDAPProcessReplicationData();
   virtual ~nsAbLDAPProcessReplicationData();
 
   // nsILDAPMessageListener
   NS_IMETHOD OnLDAPMessage(nsILDAPMessage *aMessage) MOZ_OVERRIDE;
 
--- a/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
@@ -11,17 +11,17 @@
 #include "nsILDAPURL.h"
 #include "nsAbBaseCID.h"
 #include "nsAbUtils.h"
 #include "nsDirPrefs.h"
 #include "prmem.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbLDAPReplicationQuery,
+NS_IMPL_ISUPPORTS1(nsAbLDAPReplicationQuery,
                               nsIAbLDAPReplicationQuery)
 
 nsAbLDAPReplicationQuery::nsAbLDAPReplicationQuery()
     :  mInitialized(false)
 {
 }
 
 nsresult nsAbLDAPReplicationQuery::InitLDAPData()
--- a/mailnews/addrbook/src/nsAbLDAPReplicationQuery.h
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationQuery.h
@@ -14,17 +14,17 @@
 #include "nsILDAPOperation.h"
 #include "nsILDAPURL.h"
 #include "nsDirPrefs.h"
 #include "nsStringGlue.h"
 
 class nsAbLDAPReplicationQuery : public nsIAbLDAPReplicationQuery
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIABLDAPREPLICATIONQUERY
 
   nsAbLDAPReplicationQuery();
 
   nsresult InitLDAPData();
   nsresult ConnectToLDAPServer();
 
 protected :
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -124,22 +124,18 @@ nsAbManager::nsAbManager()
 {
   mAbStore.Init();
 }
 
 nsAbManager::~nsAbManager()
 {
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsAbManager)
-NS_IMPL_THREADSAFE_RELEASE(nsAbManager)
-NS_IMPL_QUERY_INTERFACE3(nsAbManager,
-                         nsIAbManager,
-                         nsICommandLineHandler,
-                         nsIObserver)
+NS_IMPL_ISUPPORTS3(nsAbManager, nsIAbManager, nsICommandLineHandler,
+  nsIObserver)
 
 nsresult nsAbManager::Init()
 {
   NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   NS_ENSURE_TRUE(observerService, NS_ERROR_UNEXPECTED);
--- a/mailnews/addrbook/src/nsAbManager.h
+++ b/mailnews/addrbook/src/nsAbManager.h
@@ -21,17 +21,17 @@ class nsAbManager : public nsIAbManager,
                     public nsICommandLineHandler,
                     public nsIObserver
 {
   
 public:
 	nsAbManager();
 	virtual ~nsAbManager();
 
-	NS_DECL_ISUPPORTS
+	NS_DECL_THREADSAFE_ISUPPORTS
  	NS_DECL_NSIABMANAGER
   NS_DECL_NSIOBSERVER
   NS_DECL_NSICOMMANDLINEHANDLER
 
   nsresult Init();
 
 private:
   nsresult GetRootDirectory(nsIAbDirectory **aResult);
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -137,57 +137,26 @@ nsAddrDatabase::nsAddrDatabase()
 nsAddrDatabase::~nsAddrDatabase()
 {
     Close(false);    // better have already been closed.
 
     // better not be any listeners, because we're going away.
     NS_ASSERTION(m_ChangeListeners.Length() == 0, "shouldn't have any listeners");
 
     RemoveFromCache(this);
-}
-
-NS_IMPL_THREADSAFE_ADDREF(nsAddrDatabase)
-
-NS_IMETHODIMP_(nsrefcnt) nsAddrDatabase::Release(void)
-{
-  // XXX FIX THIS
-  NS_PRECONDITION(0 != mRefCnt, "dup release");
-  nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt);
-  NS_LOG_RELEASE(this, count,"nsAddrDatabase");
-  if (count == 0)    // OK, the cache is no longer holding onto this, so we really want to delete it,
-  {                // after removing it from the cache.
-    mRefCnt = 1; /* stabilize */
-    RemoveFromCache(this);
     // clean up after ourself!
     if (m_mdbPabTable)
       m_mdbPabTable->Release();
     if (m_mdbDeletedCardsTable)
       m_mdbDeletedCardsTable->Release();
     NS_IF_RELEASE(m_mdbStore);
     NS_IF_RELEASE(m_mdbEnv);
-    delete this;
-    return 0;
-  }
-  return count;
 }
 
-NS_IMETHODIMP nsAddrDatabase::QueryInterface(REFNSIID aIID, void** aResult)
-{
-    if (aResult == NULL)
-        return NS_ERROR_NULL_POINTER;
-
-    if (aIID.Equals(NS_GET_IID(nsIAddrDatabase)) ||
-        aIID.Equals(NS_GET_IID(nsIAddrDBAnnouncer)) ||
-        aIID.Equals(NS_GET_IID(nsISupports))) {
-        *aResult = static_cast<nsIAddrDatabase*>(this);
-        NS_ADDREF_THIS();
-        return NS_OK;
-    }
-    return NS_NOINTERFACE;
-}
+NS_IMPL_ISUPPORTS2(nsAddrDatabase, nsIAddrDatabase, nsIAddrDBAnnouncer)
 
 NS_IMETHODIMP nsAddrDatabase::AddListener(nsIAddrDBListener *listener)
 {
   NS_ENSURE_ARG_POINTER(listener);
   return m_ChangeListeners.AppendElement(listener) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsAddrDatabase::RemoveListener(nsIAddrDBListener *listener)
--- a/mailnews/addrbook/src/nsAddrDatabase.h
+++ b/mailnews/addrbook/src/nsAddrDatabase.h
@@ -21,17 +21,17 @@ typedef enum
   AB_NotifyInserted,
   AB_NotifyDeleted,
   AB_NotifyPropertyChanged
 } AB_NOTIFY_CODE;
 
 class nsAddrDatabase : public nsIAddrDatabase
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIADDRDBANNOUNCER
   //////////////////////////////////////////////////////////////////////////////
   // nsIAddrDatabase methods:
 
   NS_IMETHOD GetDbPath(nsIFile * *aDbPath) MOZ_OVERRIDE;
   NS_IMETHOD SetDbPath(nsIFile * aDbPath) MOZ_OVERRIDE;
   NS_IMETHOD Open(nsIFile *aMabFile, bool aCreate, bool upgrading, nsIAddrDatabase **pCardDB) MOZ_OVERRIDE;
   NS_IMETHOD Close(bool forceCommit) MOZ_OVERRIDE;
--- a/mailnews/base/src/nsCopyMessageStreamListener.cpp
+++ b/mailnews/base/src/nsCopyMessageStreamListener.cpp
@@ -7,25 +7,18 @@
 #include "nsIMsgMailNewsUrl.h"
 #include "nsIMailboxUrl.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgImapMailFolder.h"
 #include "nsIMsgMessageService.h"
 #include "nsMsgUtils.h"
 #include "netCore.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsCopyMessageStreamListener)
-NS_IMPL_THREADSAFE_RELEASE(nsCopyMessageStreamListener)
-
-NS_INTERFACE_MAP_BEGIN(nsCopyMessageStreamListener)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener)
-   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
-   NS_INTERFACE_MAP_ENTRY(nsICopyMessageStreamListener)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS3(nsCopyMessageStreamListener, nsIStreamListener,
+  nsIRequestObserver, nsICopyMessageStreamListener)
 
 static nsresult GetMessage(nsIURI *aURL, nsIMsgDBHdr **message)
 {
   NS_ENSURE_ARG_POINTER(message);
 
 	nsCOMPtr<nsIMsgMessageUrl> uriURL;
 	nsresult rv;
 
--- a/mailnews/base/src/nsCopyMessageStreamListener.h
+++ b/mailnews/base/src/nsCopyMessageStreamListener.h
@@ -14,17 +14,17 @@
 #include "nsIURI.h"
 
 class nsCopyMessageStreamListener : public nsIStreamListener, public nsICopyMessageStreamListener {
 
 public:
 	nsCopyMessageStreamListener();
 	virtual ~nsCopyMessageStreamListener();
 
-	NS_DECL_ISUPPORTS
+	NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSICOPYMESSAGESTREAMLISTENER
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
 protected:
 	nsCOMPtr<nsICopyMessageListener> mDestination;
 	nsCOMPtr<nsISupports> mListenerData;
 	nsCOMPtr<nsIMsgFolder> mSrcFolder;
--- a/mailnews/base/src/nsMessengerBootstrap.cpp
+++ b/mailnews/base/src/nsMessengerBootstrap.cpp
@@ -10,20 +10,17 @@
 #include "nsIMsgFolder.h"
 #include "nsIWindowWatcher.h"
 #include "nsMsgUtils.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIDOMWindow.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMessengerBootstrap)
-NS_IMPL_THREADSAFE_RELEASE(nsMessengerBootstrap)
-
-NS_IMPL_QUERY_INTERFACE1(nsMessengerBootstrap, nsIMessengerWindowService)
+NS_IMPL_ISUPPORTS1(nsMessengerBootstrap, nsIMessengerWindowService)
 
 nsMessengerBootstrap::nsMessengerBootstrap()
 {
 }
 
 nsMessengerBootstrap::~nsMessengerBootstrap()
 {
 }
--- a/mailnews/base/src/nsMessengerBootstrap.h
+++ b/mailnews/base/src/nsMessengerBootstrap.h
@@ -17,13 +17,13 @@
 
 class nsMessengerBootstrap :
     public nsIMessengerWindowService
 {
 public:
   nsMessengerBootstrap();
   virtual ~nsMessengerBootstrap();
 
-  NS_DECL_ISUPPORTS  
+  NS_DECL_THREADSAFE_ISUPPORTS  
   NS_DECL_NSIMESSENGERWINDOWSERVICE
 };
 
 #endif
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -109,17 +109,17 @@ struct findServerEntry {
       server(nullptr)
     {}
 };
 
 static PLDHashOperator
 hashCleanupDeferral(nsCStringHashKey::KeyType aKey,
                     nsCOMPtr<nsIMsgIncomingServer>& aServer, void* aClosure);
 
-NS_IMPL_THREADSAFE_ISUPPORTS5(nsMsgAccountManager,
+NS_IMPL_ISUPPORTS5(nsMsgAccountManager,
                               nsIMsgAccountManager,
                               nsIObserver,
                               nsISupportsWeakReference,
                               nsIUrlListener,
                               nsIFolderListener)
 
 nsMsgAccountManager::nsMsgAccountManager() :
   m_accountsLoaded(false),
--- a/mailnews/base/src/nsMsgAccountManager.h
+++ b/mailnews/base/src/nsMsgAccountManager.h
@@ -67,17 +67,17 @@ class nsMsgAccountManager: public nsIMsg
     public nsIUrlListener,
     public nsIFolderListener
 {
 public:
 
   nsMsgAccountManager();
   virtual ~nsMsgAccountManager();
   
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
  
   /* nsIMsgAccountManager methods */
   
   NS_DECL_NSIMSGACCOUNTMANAGER
   NS_DECL_NSIOBSERVER  
   NS_DECL_NSIURLLISTENER
   NS_DECL_NSIFOLDERLISTENER
 
--- a/mailnews/base/src/nsMsgCopyService.cpp
+++ b/mailnews/base/src/nsMsgCopyService.cpp
@@ -422,17 +422,17 @@ nsMsgCopyService::FindRequest(nsISupport
         break;
     else
         copyRequest = nullptr;
   }
 
   return copyRequest;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgCopyService, nsIMsgCopyService)
+NS_IMPL_ISUPPORTS1(nsMsgCopyService, nsIMsgCopyService)
 
 NS_IMETHODIMP
 nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
                                nsIArray* messages,
                                nsIMsgFolder* dstFolder,
                                bool isMove,
                                nsIMsgCopyServiceListener* listener,
                                nsIMsgWindow* window,
--- a/mailnews/base/src/nsMsgCopyService.h
+++ b/mailnews/base/src/nsMsgCopyService.h
@@ -67,17 +67,17 @@ public:
 };
 
 class nsMsgCopyService : public nsIMsgCopyService
 {
 public:
   nsMsgCopyService();
   virtual ~nsMsgCopyService();
 
-  NS_DECL_ISUPPORTS 
+  NS_DECL_THREADSAFE_ISUPPORTS 
 
   NS_DECL_NSIMSGCOPYSERVICE
 
 private:
 
   nsresult ClearRequest(nsCopyRequest* aRequest, nsresult rv);
   nsresult DoCopy(nsCopyRequest* aRequest);
   nsresult DoNextCopy();
--- a/mailnews/base/src/nsMsgMailSession.cpp
+++ b/mailnews/base/src/nsMsgMailSession.cpp
@@ -25,24 +25,18 @@
 #include "nsIMsgMailNewsUrl.h"
 #include "prcmon.h"
 #include "nsThreadUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIProperties.h"
 #include "mozilla/Services.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgMailSession)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgMailSession)
-NS_INTERFACE_MAP_BEGIN(nsMsgMailSession)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgMailSession)
-  NS_INTERFACE_MAP_ENTRY(nsIFolderListener)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgMailSession)
-NS_INTERFACE_MAP_END_THREADSAFE
-  
+NS_IMPL_ISUPPORTS2(nsMsgMailSession, nsIMsgMailSession, nsIFolderListener)
+
 nsMsgMailSession::nsMsgMailSession()
 {
 }
 
 
 nsMsgMailSession::~nsMsgMailSession()
 {
   Shutdown();
--- a/mailnews/base/src/nsMsgMailSession.h
+++ b/mailnews/base/src/nsMsgMailSession.h
@@ -32,17 +32,17 @@
 
 class nsMsgMailSession : public nsIMsgMailSession,
                          public nsIFolderListener
 {
 public:
   nsMsgMailSession();
   virtual ~nsMsgMailSession();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGMAILSESSION
   NS_DECL_NSIFOLDERLISTENER
 
   nsresult Init();
   nsresult GetSelectedLocaleDataDir(nsIFile *defaultsDir);
 
 protected:
   struct folderListener {
--- a/mailnews/base/src/nsMsgOfflineManager.cpp
+++ b/mailnews/base/src/nsMsgOfflineManager.cpp
@@ -23,17 +23,17 @@
 #include "nsIMsgStatusFeedback.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 #include "nsIArray.h"
 #include "nsArrayUtils.h"
 
 static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID);
 
-NS_IMPL_THREADSAFE_ISUPPORTS5(nsMsgOfflineManager,
+NS_IMPL_ISUPPORTS5(nsMsgOfflineManager,
                               nsIMsgOfflineManager,
                               nsIMsgSendLaterListener,
                               nsIObserver,
                               nsISupportsWeakReference,
                               nsIUrlListener)
 
 nsMsgOfflineManager::nsMsgOfflineManager() :
   m_inProgress (false),
--- a/mailnews/base/src/nsMsgOfflineManager.h
+++ b/mailnews/base/src/nsMsgOfflineManager.h
@@ -23,17 +23,17 @@ class nsMsgOfflineManager
       public nsIMsgSendLaterListener,
     public nsIUrlListener
 {
 public:
 
   nsMsgOfflineManager();
   virtual ~nsMsgOfflineManager();
   
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
  
   /* nsIMsgOfflineManager methods */
   
   NS_DECL_NSIMSGOFFLINEMANAGER
   NS_DECL_NSIOBSERVER  
   NS_DECL_NSIURLLISTENER
   NS_DECL_NSIMSGSENDLATERLISTENER
 
--- a/mailnews/base/src/nsMsgProgress.cpp
+++ b/mailnews/base/src/nsMsgProgress.cpp
@@ -12,27 +12,18 @@
 #include "nsIComponentManager.h"
 #include "nsError.h"
 #include "nsIWindowWatcher.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
 #include "mozilla/Services.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgProgress)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgProgress)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgProgress)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgStatusFeedback)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgProgress)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgStatusFeedback)
-  NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
-  NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink)
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS5(nsMsgProgress, nsIMsgStatusFeedback, nsIMsgProgress,
+  nsIWebProgressListener, nsIProgressEventSink, nsISupportsWeakReference)
 
 
 nsMsgProgress::nsMsgProgress()
 {
   m_closeProgress = false;
   m_processCanceled = false;
   m_pendingStateFlags = -1;
   m_pendingStateValue = NS_OK;
--- a/mailnews/base/src/nsMsgProgress.h
+++ b/mailnews/base/src/nsMsgProgress.h
@@ -21,17 +21,17 @@ class nsMsgProgress : public nsIMsgProgr
                       public nsIMsgStatusFeedback, 
                       public nsIProgressEventSink,
                       public nsSupportsWeakReference
 {
 public: 
   nsMsgProgress();
   virtual ~nsMsgProgress();
   
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGPROGRESS
   NS_DECL_NSIWEBPROGRESSLISTENER
   NS_DECL_NSIMSGSTATUSFEEDBACK
   NS_DECL_NSIPROGRESSEVENTSINK
 
 private:
   nsresult ReleaseListeners(void);
   
--- a/mailnews/base/src/nsMsgStatusFeedback.cpp
+++ b/mailnews/base/src/nsMsgStatusFeedback.cpp
@@ -39,26 +39,18 @@ nsMsgStatusFeedback::nsMsgStatusFeedback
   m_msgLoadedAtom = MsgGetAtom("msgLoaded");
 }
 
 nsMsgStatusFeedback::~nsMsgStatusFeedback()
 {
   mBundle = nullptr;
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgStatusFeedback)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgStatusFeedback)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgStatusFeedback)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgStatusFeedback)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgStatusFeedback)
-  NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink) 
-  NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) 
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS4(nsMsgStatusFeedback, nsIMsgStatusFeedback,
+  nsIProgressEventSink, nsIWebProgressListener, nsISupportsWeakReference)
 
 //////////////////////////////////////////////////////////////////////////////////
 // nsMsgStatusFeedback::nsIWebProgressListener
 //////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsMsgStatusFeedback::OnProgressChange(nsIWebProgress* aWebProgress,
                                       nsIRequest* aRequest,
--- a/mailnews/base/src/nsMsgStatusFeedback.h
+++ b/mailnews/base/src/nsMsgStatusFeedback.h
@@ -20,17 +20,17 @@ class nsMsgStatusFeedback : public nsIMs
                             public nsIProgressEventSink,
                             public nsIWebProgressListener,
                             public nsSupportsWeakReference
 {
 public:
   nsMsgStatusFeedback();
   virtual ~nsMsgStatusFeedback();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGSTATUSFEEDBACK
   NS_DECL_NSIWEBPROGRESSLISTENER
   NS_DECL_NSIPROGRESSEVENTSINK
 
 protected:
   bool             m_meteorsSpinning;
   int32_t          m_lastPercent;
   int64_t          m_lastProgressTime;
--- a/mailnews/base/src/nsMsgWindow.cpp
+++ b/mailnews/base/src/nsMsgWindow.cpp
@@ -36,17 +36,17 @@
 #include "nsIAuthPrompt.h"
 
 // used to dispatch urls to default protocol handlers
 #include "nsCExternalHandlerService.h"
 #include "nsIExternalProtocolService.h"
 
 static NS_DEFINE_CID(kTransactionManagerCID, NS_TRANSACTIONMANAGER_CID);
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsMsgWindow,
+NS_IMPL_ISUPPORTS3(nsMsgWindow,
                               nsIMsgWindow,
                               nsIURIContentListener,
                               nsISupportsWeakReference)
 
 nsMsgWindow::nsMsgWindow()
 {
   mCharsetOverride = false;
   m_stopped = false;
--- a/mailnews/base/src/nsMsgWindow.h
+++ b/mailnews/base/src/nsMsgWindow.h
@@ -19,17 +19,17 @@
 
 class nsMsgWindow : public nsIMsgWindow,
                     public nsIURIContentListener,
                     public nsSupportsWeakReference
 {
 
 public:
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   nsMsgWindow();
   virtual ~nsMsgWindow();
   nsresult Init();
   NS_DECL_NSIMSGWINDOW
   NS_DECL_NSIURICONTENTLISTENER
 
 protected:
--- a/mailnews/base/src/nsSubscribableServer.cpp
+++ b/mailnews/base/src/nsSubscribableServer.cpp
@@ -53,17 +53,17 @@ nsSubscribableServer::~nsSubscribableSer
     nsresult rv = NS_OK;
 #ifdef DEBUG_seth
     printf("free subscribe tree\n");
 #endif
     rv = FreeSubtree(mTreeRoot);
     NS_ASSERTION(NS_SUCCEEDED(rv),"failed to free tree");
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsSubscribableServer, nsISubscribableServer)
+NS_IMPL_ISUPPORTS1(nsSubscribableServer, nsISubscribableServer)
 
 NS_IMETHODIMP
 nsSubscribableServer::SetIncomingServer(nsIMsgIncomingServer *aServer)
 {
   mIncomingServer = aServer;
   return NS_OK;
 }
 
--- a/mailnews/base/src/nsSubscribableServer.h
+++ b/mailnews/base/src/nsSubscribableServer.h
@@ -38,17 +38,17 @@ typedef struct _subscribeTreeNode {
 class nsSubscribableServer : public nsISubscribableServer
 {
  public:
   nsSubscribableServer();
   virtual ~nsSubscribableServer();
 
   nsresult Init();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISUBSCRIBABLESERVER
   
 private:
   nsresult ConvertNameToUnichar(const char *inStr, PRUnichar **outStr);
   nsCOMPtr <nsISubscribeListener> mSubscribeListener;
   nsCOMPtr <nsIMsgIncomingServer> mIncomingServer;
   nsCOMPtr <nsISubscribeDataSource> mSubscribeDS;
   char mDelimiter;
--- a/mailnews/base/src/nsSubscribeDataSource.cpp
+++ b/mailnews/base/src/nsSubscribeDataSource.cpp
@@ -26,20 +26,17 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_
 nsSubscribeDataSource::nsSubscribeDataSource()
 {
 }
 
 nsSubscribeDataSource::~nsSubscribeDataSource()
 {
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsSubscribeDataSource)
-NS_IMPL_THREADSAFE_RELEASE(nsSubscribeDataSource)
-
-NS_IMPL_QUERY_INTERFACE2(nsSubscribeDataSource, nsIRDFDataSource, nsISubscribeDataSource) 
+NS_IMPL_ISUPPORTS2(nsSubscribeDataSource, nsIRDFDataSource, nsISubscribeDataSource) 
 
 nsresult
 nsSubscribeDataSource::Init()
 {
     nsresult rv;
 
     mRDFService = do_GetService(kRDFServiceCID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv) && mRDFService, "failed to get rdf service");
--- a/mailnews/base/src/nsSubscribeDataSource.h
+++ b/mailnews/base/src/nsSubscribeDataSource.h
@@ -21,17 +21,17 @@ class nsSubscribeDataSource : public nsI
 {
 
 public:
   nsSubscribeDataSource();
   virtual ~nsSubscribeDataSource();
 
   nsresult Init();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRDFDATASOURCE
   NS_DECL_NSISUBSCRIBEDATASOURCE
 
 private:
   nsCOMPtr <nsIRDFResource>      kNC_Child;
   nsCOMPtr <nsIRDFResource>      kNC_Name;    
   nsCOMPtr <nsIRDFResource>      kNC_LeafName;
   nsCOMPtr <nsIRDFResource>      kNC_Subscribed;
--- a/mailnews/base/util/nsMsgCompressIStream.cpp
+++ b/mailnews/base/util/nsMsgCompressIStream.cpp
@@ -17,17 +17,17 @@ nsMsgCompressIStream::nsMsgCompressIStre
 {
 }
 
 nsMsgCompressIStream::~nsMsgCompressIStream()
 {
   Close();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsMsgCompressIStream, nsIInputStream,
+NS_IMPL_ISUPPORTS2(nsMsgCompressIStream, nsIInputStream,
                               nsIAsyncInputStream)
 
 nsresult nsMsgCompressIStream::InitInputStream(nsIInputStream *rawStream)
 {
   // protect against repeat calls
   if (m_iStream)
     return NS_ERROR_UNEXPECTED;
 
--- a/mailnews/base/util/nsMsgCompressIStream.h
+++ b/mailnews/base/util/nsMsgCompressIStream.h
@@ -10,17 +10,17 @@
 #include "zlib.h"
 
 class NS_MSG_BASE nsMsgCompressIStream : public nsIAsyncInputStream
 {
 public:
   nsMsgCompressIStream();
   ~nsMsgCompressIStream();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
     
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIASYNCINPUTSTREAM
 
   nsresult InitInputStream(nsIInputStream *rawStream);
 
 protected:
   nsresult DoInflation();
--- a/mailnews/base/util/nsMsgCompressOStream.cpp
+++ b/mailnews/base/util/nsMsgCompressOStream.cpp
@@ -13,17 +13,17 @@ nsMsgCompressOStream::nsMsgCompressOStre
 {
 }
 
 nsMsgCompressOStream::~nsMsgCompressOStream()
 {
   Close();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgCompressOStream, nsIOutputStream)
+NS_IMPL_ISUPPORTS1(nsMsgCompressOStream, nsIOutputStream)
 
 nsresult nsMsgCompressOStream::InitOutputStream(nsIOutputStream *rawStream)
 {
   // protect against repeat calls
   if (m_oStream)
     return NS_ERROR_UNEXPECTED;
 
   // allocate some memory for a buffer
--- a/mailnews/base/util/nsMsgCompressOStream.h
+++ b/mailnews/base/util/nsMsgCompressOStream.h
@@ -9,17 +9,17 @@
 #include "zlib.h"
 
 class NS_MSG_BASE nsMsgCompressOStream : public nsIOutputStream
 {
 public:
   nsMsgCompressOStream();
   ~nsMsgCompressOStream();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSIOUTPUTSTREAM
 
   nsresult InitOutputStream(nsIOutputStream *rawStream);
 
 protected:
   nsCOMPtr<nsIOutputStream> m_oStream;
   nsAutoArrayPtr<char> m_zbuf;
--- a/mailnews/base/util/nsMsgIdentity.cpp
+++ b/mailnews/base/util/nsMsgIdentity.cpp
@@ -23,17 +23,17 @@
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsArrayUtils.h"
 
 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
 
 #define REL_FILE_PREF_SUFFIX "-rel"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgIdentity,
+NS_IMPL_ISUPPORTS1(nsMsgIdentity,
                    nsIMsgIdentity)
 
 /*
  * accessors for pulling values directly out of preferences
  * instead of member variables, etc
  */
 
 NS_IMETHODIMP
--- a/mailnews/base/util/nsMsgIdentity.h
+++ b/mailnews/base/util/nsMsgIdentity.h
@@ -10,17 +10,17 @@
 #include "nsIPrefBranch.h"
 #include "msgCore.h"
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
 
 class NS_MSG_BASE nsMsgIdentity : public nsIMsgIdentity
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGIDENTITY
   
 private:
   nsCString mKey;
   nsCOMPtr<nsIPrefBranch> mPrefBranch;
   nsCOMPtr<nsIPrefBranch> mDefPrefBranch;
 
 protected:
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -63,23 +63,18 @@ nsMsgIncomingServer::nsMsgIncomingServer
 { 
   m_downloadedHdrs.Init(50);
 }
 
 nsMsgIncomingServer::~nsMsgIncomingServer()
 {
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgIncomingServer)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgIncomingServer)
-NS_INTERFACE_MAP_BEGIN(nsMsgIncomingServer)
-    NS_INTERFACE_MAP_ENTRY(nsIMsgIncomingServer)
-    NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgIncomingServer)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS2(nsMsgIncomingServer, nsIMsgIncomingServer,
+  nsISupportsWeakReference)
 
 NS_IMETHODIMP
 nsMsgIncomingServer::SetServerBusy(bool aServerBusy)
 {
   m_serverBusy = aServerBusy;
   return NS_OK;
 }
 
--- a/mailnews/base/util/nsMsgIncomingServer.h
+++ b/mailnews/base/util/nsMsgIncomingServer.h
@@ -37,17 +37,17 @@ class nsIMsgProtocolInfo;
 
 class NS_MSG_BASE nsMsgIncomingServer : public nsIMsgIncomingServer,
                                         public nsSupportsWeakReference
 {
  public:
   nsMsgIncomingServer();
   virtual ~nsMsgIncomingServer();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGINCOMINGSERVER
 
 protected:
   nsCString m_serverKey;
 
   // Sets m_password, if password found. Can return NS_ERROR_ABORT if the 
   // user cancels the master password dialog.
   nsresult GetPasswordWithoutUI();
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -49,25 +49,17 @@ nsMsgMailNewsUrl::nsMsgMailNewsUrl()
   }                                                                    \
   PR_END_MACRO
 
 nsMsgMailNewsUrl::~nsMsgMailNewsUrl()
 {
   PR_FREEIF(m_errorMessage);
 }
   
-NS_IMPL_THREADSAFE_ADDREF(nsMsgMailNewsUrl)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgMailNewsUrl)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgMailNewsUrl)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgMailNewsUrl)
-   NS_INTERFACE_MAP_ENTRY(nsIMsgMailNewsUrl)
-   NS_INTERFACE_MAP_ENTRY(nsIURL)
-   NS_INTERFACE_MAP_ENTRY(nsIURI)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS3(nsMsgMailNewsUrl, nsIMsgMailNewsUrl, nsIURL, nsIURI)
 
 ////////////////////////////////////////////////////////////////////////////////////
 // Begin nsIMsgMailNewsUrl specific support
 ////////////////////////////////////////////////////////////////////////////////////
 
 nsresult nsMsgMailNewsUrl::GetUrlState(bool * aRunningUrl)
 {
   if (aRunningUrl)
--- a/mailnews/base/util/nsMsgMailNewsUrl.h
+++ b/mailnews/base/util/nsMsgMailNewsUrl.h
@@ -36,17 +36,17 @@
 #undef  IMETHOD_VISIBILITY
 #define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
 
 class NS_MSG_BASE nsMsgMailNewsUrl : public nsIMsgMailNewsUrl
 {
 public:
     nsMsgMailNewsUrl();
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIMSGMAILNEWSURL
     NS_DECL_NSIURI
     NS_DECL_NSIURL
 
 protected:
   virtual ~nsMsgMailNewsUrl();
 
   nsCOMPtr<nsIURL> m_baseURL;
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -37,27 +37,18 @@
 #include "nsAlgorithm.h"
 #include "mozilla/Services.h"
 #include <algorithm>
 
 #undef PostMessage // avoid to collision with WinUser.h
 
 using namespace mozilla;
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgProtocol)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgProtocol)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgProtocol)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIChannel)
-   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
-   NS_INTERFACE_MAP_ENTRY(nsIChannel)
-   NS_INTERFACE_MAP_ENTRY(nsIRequest)
-   NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS5(nsMsgProtocol, nsIChannel, nsIStreamListener,
+  nsIRequestObserver, nsIRequest, nsITransportEventSink)
 
 static PRUnichar *FormatStringWithHostNameByID(int32_t stringID, nsIMsgMailNewsUrl *msgUri);
 
 
 nsMsgProtocol::nsMsgProtocol(nsIURI * aURL)
 {
   m_flags = 0;
   m_readCount = 0;
@@ -1032,17 +1023,18 @@ nsresult nsMsgProtocol::DoNtlmStep2(nsCS
 
 /////////////////////////////////////////////////////////////////////
 // nsMsgAsyncWriteProtocol subclass and related helper classes
 /////////////////////////////////////////////////////////////////////
 
 class nsMsgProtocolStreamProvider : public nsIOutputStreamCallback
 {
 public:
-    NS_DECL_ISUPPORTS
+    // XXX this probably doesn't need to be threadsafe
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsMsgProtocolStreamProvider() { }
     virtual ~nsMsgProtocolStreamProvider() {}
 
     void Init(nsMsgAsyncWriteProtocol *aProtInstance, nsIInputStream *aInputStream)
     {
       mMsgProtocol = do_GetWeakReference(static_cast<nsIStreamListener*> (aProtInstance));
       mInStream = aInputStream;
@@ -1108,45 +1100,38 @@ public:
     }
 
 
 protected:
   nsCOMPtr<nsIWeakReference> mMsgProtocol;
   nsCOMPtr<nsIInputStream>  mInStream;
 };
 
-// XXX this probably doesn't need to be threadsafe
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgProtocolStreamProvider,
+NS_IMPL_ISUPPORTS1(nsMsgProtocolStreamProvider,
                               nsIOutputStreamCallback)
 
 class nsMsgFilePostHelper : public nsIStreamListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
   nsMsgFilePostHelper() { mSuspendedPostFileRead = false;}
   nsresult Init(nsIOutputStream * aOutStream, nsMsgAsyncWriteProtocol * aProtInstance, nsIFile *aFileToPost);
   virtual ~nsMsgFilePostHelper() {}
   nsCOMPtr<nsIRequest> mPostFileRequest;
   bool mSuspendedPostFileRead;
   void CloseSocket() { mProtInstance = nullptr; }
 protected:
   nsCOMPtr<nsIOutputStream> mOutStream;
   nsCOMPtr<nsIWeakReference> mProtInstance;
 };
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgFilePostHelper)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgFilePostHelper)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgFilePostHelper)
-  NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-  NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS2(nsMsgFilePostHelper, nsIStreamListener, nsIRequestObserver)
 
 nsresult nsMsgFilePostHelper::Init(nsIOutputStream * aOutStream, nsMsgAsyncWriteProtocol * aProtInstance, nsIFile *aFileToPost)
 {
   nsresult rv = NS_OK;
   mOutStream = aOutStream;
   mProtInstance = do_GetWeakReference(static_cast<nsIStreamListener*> (aProtInstance));
 
   nsCOMPtr<nsIInputStream> stream;
--- a/mailnews/base/util/nsMsgProtocol.h
+++ b/mailnews/base/util/nsMsgProtocol.h
@@ -48,17 +48,17 @@ class nsIProxyInfo;
 class NS_MSG_BASE nsMsgProtocol : public nsIStreamListener
                                 , public nsIChannel
                                 , public nsITransportEventSink
 {
 public:
   nsMsgProtocol(nsIURI * aURL);
   virtual ~nsMsgProtocol();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   // nsIChannel support
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUEST
   
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSITRANSPORTEVENTSINK
 
--- a/mailnews/base/util/nsMsgTxn.cpp
+++ b/mailnews/base/util/nsMsgTxn.cpp
@@ -9,18 +9,18 @@
 #include "nsCOMArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIVariant.h"
 #include "nsIProperty.h"
 #include "nsMsgMessageFlags.h"
 #include "nsIMsgFolder.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgTxn)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgTxn)
+NS_IMPL_ADDREF(nsMsgTxn)
+NS_IMPL_RELEASE(nsMsgTxn)
 NS_INTERFACE_MAP_BEGIN(nsMsgTxn)
   NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY(nsITransaction)
   NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
   NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
 NS_INTERFACE_MAP_END
--- a/mailnews/base/util/nsMsgTxn.h
+++ b/mailnews/base/util/nsMsgTxn.h
@@ -47,17 +47,17 @@ public:
     NS_IMETHOD GetIsTransient(bool *aIsTransient) MOZ_OVERRIDE;
 
     NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge) MOZ_OVERRIDE;
 
     nsresult GetMsgWindow(nsIMsgWindow **msgWindow);
     nsresult SetMsgWindow(nsIMsgWindow *msgWindow);
     nsresult SetTransactionType(uint32_t txnType);
  
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPROPERTYBAG
     NS_DECL_NSIPROPERTYBAG2
     NS_DECL_NSIWRITABLEPROPERTYBAG
     NS_DECL_NSIWRITABLEPROPERTYBAG2
 
 protected:
     // a hash table of string -> nsIVariant
     nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -1944,29 +1944,29 @@ NS_MSG_BASE void MsgReplaceSubstring(nsA
     i += replacementLength;
   }
 }
 
 /* This class is based on nsInterfaceRequestorAgg from nsInterfaceRequestorAgg.h */
 class MsgInterfaceRequestorAgg : public nsIInterfaceRequestor
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIINTERFACEREQUESTOR
 
   MsgInterfaceRequestorAgg(nsIInterfaceRequestor *aFirst,
                            nsIInterfaceRequestor *aSecond)
     : mFirst(aFirst)
     , mSecond(aSecond) {}
 
   nsCOMPtr<nsIInterfaceRequestor> mFirst, mSecond;
 };
 
 // XXX This needs to support threadsafe refcounting until we fix bug 243591.
-NS_IMPL_THREADSAFE_ISUPPORTS1(MsgInterfaceRequestorAgg, nsIInterfaceRequestor)
+NS_IMPL_ISUPPORTS1(MsgInterfaceRequestorAgg, nsIInterfaceRequestor)
 
 NS_IMETHODIMP
 MsgInterfaceRequestorAgg::GetInterface(const nsIID &aIID, void **aResult)
 {
   nsresult rv = NS_ERROR_NO_INTERFACE;
   if (mFirst)
     rv = mFirst->GetInterface(aIID, aResult);
   if (mSecond && NS_FAILED(rv))
--- a/mailnews/compose/src/nsMsgCompFields.cpp
+++ b/mailnews/compose/src/nsMsgCompFields.cpp
@@ -13,17 +13,17 @@
 #include "nsIMsgMdnGenerator.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMsgMimeCID.h"
 #include "nsIMimeConverter.h"
 #include "nsArrayEnumerator.h"
 #include "nsMemory.h"
 
 /* the following macro actually implement addref, release and query interface for our component. */
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgCompFields, nsIMsgCompFields)
+NS_IMPL_ISUPPORTS1(nsMsgCompFields, nsIMsgCompFields)
 
 nsMsgCompFields::nsMsgCompFields()
 {
   int16_t i;
   for (i = 0; i < MSG_MAX_HEADERS; i ++)
     m_headers[i] = nullptr;
 
   m_body.Truncate();
--- a/mailnews/compose/src/nsMsgCompFields.h
+++ b/mailnews/compose/src/nsMsgCompFields.h
@@ -40,17 +40,17 @@ struct nsMsgRecipient
    to NULL.  This makes it real handy for the callers. */
 
 class nsMsgCompFields : public nsIMsgCompFields {
 public:
   nsMsgCompFields();
   virtual ~nsMsgCompFields();
 
   /* this macro defines QueryInterface, AddRef and Release for this class */
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGCOMPFIELDS
 
   typedef enum MsgHeaderID
   {
     MSG_FROM_HEADER_ID        = 0,
     MSG_REPLY_TO_HEADER_ID,
     MSG_TO_HEADER_ID,
     MSG_CC_HEADER_ID,
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -175,25 +175,18 @@ nsMsgCompose::nsMsgCompose()
 
 nsMsgCompose::~nsMsgCompose()
 {
   NS_IF_RELEASE(m_compFields);
   NS_IF_RELEASE(mQuoteStreamListener);
 }
 
 /* the following macro actually implement addref, release and query interface for our component. */
-NS_IMPL_THREADSAFE_ADDREF(nsMsgCompose)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgCompose)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgCompose)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgCompose)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgCompose)
-  NS_INTERFACE_MAP_ENTRY(nsIMsgSendListener)
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS3(nsMsgCompose, nsIMsgCompose, nsIMsgSendListener,
+  nsISupportsWeakReference)
 
 //
 // Once we are here, convert the data which we know to be UTF-8 to UTF-16
 // for insertion into the editor
 //
 nsresult
 GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParent, int32_t &aOffset)
 {
--- a/mailnews/compose/src/nsMsgCompose.h
+++ b/mailnews/compose/src/nsMsgCompose.h
@@ -33,17 +33,17 @@ struct nsMsgMailList;
 class nsMsgCompose : public nsIMsgCompose, public nsSupportsWeakReference
 {
  public: 
 
 	nsMsgCompose();
 	virtual ~nsMsgCompose();
 
 	/* this macro defines QueryInterface, AddRef and Release for this class */
-	NS_DECL_ISUPPORTS
+	NS_DECL_THREADSAFE_ISUPPORTS
 
 	/*** nsIMsgCompose pure virtual functions */
 	NS_DECL_NSIMSGCOMPOSE
 
   /* nsIMsgSendListener interface */
   NS_DECL_NSIMSGSENDLISTENER
 
 private:
--- a/mailnews/compose/src/nsMsgCopy.cpp
+++ b/mailnews/compose/src/nsMsgCopy.cpp
@@ -32,23 +32,17 @@
 #include "nsArrayUtils.h"
 
 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
 
 ////////////////////////////////////////////////////////////////////////////////////
 // This is the listener class for the copy operation. We have to create this class
 // to listen for message copy completion and eventually notify the caller
 ////////////////////////////////////////////////////////////////////////////////////
-NS_IMPL_THREADSAFE_ADDREF(CopyListener)
-NS_IMPL_THREADSAFE_RELEASE(CopyListener)
-
-NS_INTERFACE_MAP_BEGIN(CopyListener)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgCopyServiceListener)
-   NS_INTERFACE_MAP_ENTRY(nsIMsgCopyServiceListener)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS1(CopyListener, nsIMsgCopyServiceListener)
 
 CopyListener::CopyListener(void)
 {
   mCopyInProgress = false;
 }
 
 CopyListener::~CopyListener(void)
 {
--- a/mailnews/compose/src/nsMsgCopy.h
+++ b/mailnews/compose/src/nsMsgCopy.h
@@ -29,17 +29,17 @@ class   nsMsgCopy;
 ////////////////////////////////////////////////////////////////////////////////////
 class CopyListener : public nsIMsgCopyServiceListener
 {
 public:
   CopyListener(void);
   virtual ~CopyListener(void);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_IMETHOD OnStartCopy() MOZ_OVERRIDE;
   
   NS_IMETHOD OnProgress(uint32_t aProgress, uint32_t aProgressMax) MOZ_OVERRIDE;
 
   NS_IMETHOD SetMessageKey(uint32_t aMessageKey) MOZ_OVERRIDE;
   
   NS_IMETHOD GetMessageId(nsACString& aMessageId) MOZ_OVERRIDE;
--- a/mailnews/compose/src/nsMsgQuote.cpp
+++ b/mailnews/compose/src/nsMsgQuote.cpp
@@ -20,24 +20,18 @@
 #include "nsMsgUtils.h"
 #include "nsNetUtil.h"
 #include "nsMsgMimeCID.h"
 #include "nsMsgCompCID.h"
 #include "nsMsgCompose.h"
 #include "nsMsgMailNewsUrl.h"
 #include "mozilla/Services.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgQuoteListener)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgQuoteListener)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgQuoteListener)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgQuoteListener)
-   NS_INTERFACE_MAP_ENTRY(nsIMimeStreamConverterListener)
-   NS_INTERFACE_MAP_ENTRY(nsIMsgQuoteListener)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS2(nsMsgQuoteListener, nsIMsgQuoteListener,
+  nsIMimeStreamConverterListener)
 
 nsMsgQuoteListener::nsMsgQuoteListener()
 {
 }
 
 nsMsgQuoteListener::~nsMsgQuoteListener()
 {
 }
@@ -84,24 +78,17 @@ nsMsgQuote::nsMsgQuote()
   mQuoteHeaders = false;
   mQuoteListener = nullptr;
 }
 
 nsMsgQuote::~nsMsgQuote()
 {
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsMsgQuote)
-NS_IMPL_THREADSAFE_RELEASE(nsMsgQuote)
-
-NS_INTERFACE_MAP_BEGIN(nsMsgQuote)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgQuote)
-   NS_INTERFACE_MAP_ENTRY(nsIMsgQuote)
-   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS2(nsMsgQuote, nsIMsgQuote, nsISupportsWeakReference)
 
 NS_IMETHODIMP nsMsgQuote::GetStreamListener(nsIMsgQuotingOutputStreamListener ** aStreamListener)
 {
   nsresult rv = NS_OK;
   if (aStreamListener)
   {
     *aStreamListener = mStreamListener;
     NS_IF_ADDREF(*aStreamListener);
--- a/mailnews/compose/src/nsMsgQuote.h
+++ b/mailnews/compose/src/nsMsgQuote.h
@@ -16,32 +16,32 @@
 class nsMsgQuote;
 
 class nsMsgQuoteListener: public nsIMsgQuoteListener
 {
 public:
 	nsMsgQuoteListener();
 	virtual     ~nsMsgQuoteListener();
 
-	NS_DECL_ISUPPORTS
+	NS_DECL_THREADSAFE_ISUPPORTS
 
 	// nsIMimeStreamConverterListener support
 	NS_DECL_NSIMIMESTREAMCONVERTERLISTENER
   NS_DECL_NSIMSGQUOTELISTENER
 
 private:
   nsWeakPtr mMsgQuote;
 };
 
 class nsMsgQuote: public nsIMsgQuote, public nsSupportsWeakReference {
 public: 
   nsMsgQuote();
   virtual ~nsMsgQuote();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGQUOTE
 
   // 
   // Implementation data...
   //
   nsCOMPtr<nsIMsgQuotingOutputStreamListener> mStreamListener;
   bool			mQuoteHeaders;
   nsCOMPtr<nsIMsgQuoteListener> mQuoteListener;
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -242,17 +242,17 @@ NS_IMETHODIMP MsgDeliveryListener::OnSto
   if (mMsgSend)
     mMsgSend->SendDeliveryCallback(url, mIsNewsDelivery, aExitCode);
       
   return NS_OK;
 }
 
 
 /* the following macro actually implement addref, release and query interface for our component. */
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgComposeAndSend, nsIMsgSend)
+NS_IMPL_ISUPPORTS1(nsMsgComposeAndSend, nsIMsgSend)
 
 nsMsgComposeAndSend::nsMsgComposeAndSend() :
     m_messageKey(0xffffffff)
 {
   mGUINotificationEnabled = true;
   mAbortInProcess = false;
   mMultipartRelatedAttachmentCount = -1;
   mSendMailAlso = false;
--- a/mailnews/compose/src/nsMsgSend.h
+++ b/mailnews/compose/src/nsMsgSend.h
@@ -164,17 +164,17 @@ class MimeEncoder;
 
 class nsMsgComposeAndSend : public nsIMsgSend
 {
   typedef mozilla::mailnews::MimeEncoder MimeEncoder;
 public:
   //
   // Define QueryInterface, AddRef and Release for this class
   //
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   nsMsgComposeAndSend();
   virtual     ~nsMsgComposeAndSend();
 
 
   // Delivery and completion callback routines...
   NS_IMETHOD  DeliverMessage();
   NS_IMETHOD  DeliverFileAsMail();
--- a/mailnews/imap/src/nsIMAPBodyShell.cpp
+++ b/mailnews/imap/src/nsIMAPBodyShell.cpp
@@ -34,17 +34,17 @@
         2. Create a generic part object with that buffer
         3. The factory will return either a leaf or container, depending on what it really is.
         4. It is responsible for parsing its children, if there are any
 */
 
 
 ///////////// nsIMAPBodyShell ////////////////////////////////////
 
-NS_IMPL_THREADSAFE_ISUPPORTS0(nsIMAPBodyShell)
+NS_IMPL_ISUPPORTS0(nsIMAPBodyShell)
 
 nsIMAPBodyShell::nsIMAPBodyShell(nsImapProtocol *protocolConnection,
                                  nsIMAPBodypartMessage *message, uint32_t UID,
                                  const char *folderName)
 {
   m_isValid = false;
   m_isBeingGenerated = false;
   m_cached = false;
--- a/mailnews/imap/src/nsIMAPBodyShell.h
+++ b/mailnews/imap/src/nsIMAPBodyShell.h
@@ -207,17 +207,17 @@ class nsIMAPMessagePartIDArray;
 // Shell Construction occurs from a parsed a BODYSTRUCTURE response, split into empty parts.
 // Shell Generation generates a "MIME Shell" of the message and streams it to libmime for
 // display.  The MIME Shell has selected (inline) parts filled in, and leaves all others
 // for on-demand retrieval through explicit part fetches.
 
 class nsIMAPBodyShell : public nsISupports
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   nsIMAPBodyShell(nsImapProtocol *protocolConnection,
                   nsIMAPBodypartMessage *message, uint32_t UID,
                   const char *folderName);
   virtual ~nsIMAPBodyShell();
   // To be used after a shell is uncached
   void SetConnection(nsImapProtocol *con) { m_protocolConnection = con; }
   virtual bool GetIsValid() { return m_isValid; }
   virtual void SetIsValid(bool valid);
--- a/mailnews/imap/src/nsIMAPHostSessionList.cpp
+++ b/mailnews/imap/src/nsIMAPHostSessionList.cpp
@@ -53,17 +53,17 @@ nsIMAPHostInfo::~nsIMAPHostInfo()
 {
   PR_Free(fCachedPassword);
   PR_Free(fHierarchyDelimiters);
   delete fNamespaceList;
   delete fTempNamespaceList;
   delete fShellCache;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS3(nsIMAPHostSessionList,
+NS_IMPL_ISUPPORTS3(nsIMAPHostSessionList,
                               nsIImapHostSessionList,
                               nsIObserver,
                               nsISupportsWeakReference)
 
 
 nsIMAPHostSessionList::nsIMAPHostSessionList()
 {
   gCachedHostInfoMonitor = PR_NewMonitor(/* "accessing-hostlist-monitor"*/);
--- a/mailnews/imap/src/nsIMAPHostSessionList.h
+++ b/mailnews/imap/src/nsIMAPHostSessionList.h
@@ -44,17 +44,17 @@ protected:
   bool fGotNamespaces;
   nsIMAPBodyShellCache *fShellCache;
 };
 
 // this is an interface to a linked list of host info's    
 class nsIMAPHostSessionList : public nsIImapHostSessionList, public nsIObserver, public nsSupportsWeakReference
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER  
 
   nsIMAPHostSessionList();
   virtual ~nsIMAPHostSessionList();
   nsresult Init();
   // Host List
   NS_IMETHOD AddHostToList(const char *serverKey, 
                             nsIImapIncomingServer *server) MOZ_OVERRIDE;
--- a/mailnews/imap/src/nsImapFlagAndUidState.cpp
+++ b/mailnews/imap/src/nsImapFlagAndUidState.cpp
@@ -5,17 +5,17 @@
 
 #include "msgCore.h"  // for pre-compiled headers
 
 #include "nsImapCore.h"
 #include "nsImapFlagAndUidState.h"
 #include "prcmon.h"
 #include "nspr.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImapFlagAndUidState, nsIImapFlagAndUidState)
+NS_IMPL_ISUPPORTS1(nsImapFlagAndUidState, nsIImapFlagAndUidState)
 
 using namespace mozilla;
 
 NS_IMETHODIMP nsImapFlagAndUidState::GetNumberOfMessages(int32_t *result)
 {
   if (!result)
     return NS_ERROR_NULL_POINTER;
   *result = fUids.Length();
--- a/mailnews/imap/src/nsImapFlagAndUidState.h
+++ b/mailnews/imap/src/nsImapFlagAndUidState.h
@@ -14,17 +14,17 @@
 const int32_t kImapFlagAndUidStateSize =	100;
 
 #include "nsBaseHashtable.h"
 #include "nsDataHashtable.h"
 
 class nsImapFlagAndUidState : public nsIImapFlagAndUidState
 {
 public:
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     nsImapFlagAndUidState(int numberOfMessages);
     virtual ~nsImapFlagAndUidState();
 
     NS_DECL_NSIIMAPFLAGANDUIDSTATE
 
     int32_t               NumberOfDeletedMessages();
     
     imapMessageFlagsType  GetMessageFlagsFromUID(uint32_t uid, bool *foundIt, int32_t *ndx);
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -8168,17 +8168,17 @@ nsImapMailCopyState::~nsImapMailCopyStat
       srcFolder->GetUriForMsg(m_message, uri);
     }
   }
   if (m_tmpFile)
     m_tmpFile->Remove(false);
 }
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImapMailCopyState, nsImapMailCopyState)
+NS_IMPL_ISUPPORTS1(nsImapMailCopyState, nsImapMailCopyState)
 
 nsresult
 nsImapMailFolder::InitCopyState(nsISupports* srcSupport,
                                 nsIArray* messages,
                                 bool isMove,
                                 bool selectedState,
                                 bool acrossServers,
                                 uint32_t newMsgFlags,
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -44,17 +44,17 @@ class nsIMsgOfflineImapOperation;
 { 0xb64534f0, 0x3d53, 0x11d3, \
     { 0xac, 0x2a, 0x00, 0x80, 0x5f, 0x8a, 0xc9, 0x68 } }
 
 class nsImapMailCopyState: public nsISupports
 {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMAPMAILCOPYSTATE_IID)
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     nsImapMailCopyState();
     virtual ~nsImapMailCopyState();
 
     nsCOMPtr<nsISupports> m_srcSupport; // source file spec or folder
     nsCOMPtr<nsIArray> m_messages; // array of source messages
     nsRefPtr<nsImapMoveCopyMsgTxn> m_undoMsgTxn; // undo object with this copy operation
     nsCOMPtr<nsIMsgDBHdr> m_message; // current message to be copied
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -88,17 +88,17 @@ using namespace mozilla;
 #define IMAP_ENV_HEADERS "From To Cc Bcc Subject Date Message-ID "
 #define IMAP_DB_HEADERS "Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To"
 #define IMAP_ENV_AND_DB_HEADERS IMAP_ENV_HEADERS IMAP_DB_HEADERS
 static const PRIntervalTime kImapSleepTime = PR_MillisecondsToInterval(60000);
 static int32_t gPromoteNoopToCheckCount = 0;
 static const uint32_t kFlagChangesBeforeCheck = 10;
 static const int32_t kMaxSecondsBeforeCheck = 600;
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgImapHdrXferInfo, nsIImapHeaderXferInfo)
+NS_IMPL_ISUPPORTS1(nsMsgImapHdrXferInfo, nsIImapHeaderXferInfo)
 
 nsMsgImapHdrXferInfo::nsMsgImapHdrXferInfo()
   : m_hdrInfos(kNumHdrsToXfer)
 {
   m_nextFreeHdrInfo = 0;
 }
 
 nsMsgImapHdrXferInfo::~nsMsgImapHdrXferInfo()
@@ -167,17 +167,17 @@ void nsMsgImapHdrXferInfo::ResetAll()
 }
 
 void nsMsgImapHdrXferInfo::ReleaseAll()
 {
   m_hdrInfos.Clear();
   m_nextFreeHdrInfo = 0;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgImapLineDownloadCache, nsIImapHeaderInfo)
+NS_IMPL_ISUPPORTS1(nsMsgImapLineDownloadCache, nsIImapHeaderInfo)
 
 // **** helper class for downloading line ****
 nsMsgImapLineDownloadCache::nsMsgImapLineDownloadCache()
 {
     fLineInfo = (msg_line_info *) PR_CALLOC(sizeof( msg_line_info));
     fLineInfo->uidOfMessage = nsMsgKey_None;
     m_msgSize = 0;
 }
@@ -8642,28 +8642,18 @@ nsImapCacheStreamListener::OnStopRequest
 }
 
 NS_IMETHODIMP
 nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint64_t aSourceOffset, uint32_t aCount)
 {
   return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsImapMockChannel)
-NS_IMPL_THREADSAFE_RELEASE(nsImapMockChannel)
-
-NS_INTERFACE_MAP_BEGIN(nsImapMockChannel)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIImapMockChannel)
-  NS_INTERFACE_MAP_ENTRY(nsIImapMockChannel)
-  NS_INTERFACE_MAP_ENTRY(nsIChannel)
-  NS_INTERFACE_MAP_ENTRY(nsIRequest)
-  NS_INTERFACE_MAP_ENTRY(nsICacheListener)
-  NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-NS_INTERFACE_MAP_END_THREADSAFE
+NS_IMPL_ISUPPORTS6(nsImapMockChannel, nsIImapMockChannel, nsIChannel,
+  nsIRequest, nsICacheListener, nsITransportEventSink, nsISupportsWeakReference)
 
 
 nsImapMockChannel::nsImapMockChannel()
 {
   m_channelContext = nullptr;
   m_cancelStatus = NS_OK;
   mLoadFlags = 0;
   mChannelClosed = false;
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -69,17 +69,17 @@ typedef struct _msg_line_info {
     const char   *adoptedMessageLine;
     uint32_t uidOfMessage;
 } msg_line_info;
 
 
 class nsMsgImapLineDownloadCache : public nsIImapHeaderInfo, public nsByteArray
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPHEADERINFO
   nsMsgImapLineDownloadCache();
   virtual ~nsMsgImapLineDownloadCache();
     uint32_t  CurrentUID();
     uint32_t  SpaceAvailable();
     bool CacheEmpty();
 
     msg_line_info *GetCurrentLineInfo();
@@ -90,17 +90,17 @@ private:
     int32_t m_msgSize;
 };
 
 #define kNumHdrsToXfer 10
 
 class nsMsgImapHdrXferInfo : public nsIImapHeaderXferInfo
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPHEADERXFERINFO
   nsMsgImapHdrXferInfo();
   virtual ~nsMsgImapHdrXferInfo();
   void    ResetAll(); // reset HeaderInfos for re-use
   void    ReleaseAll(); // release HeaderInfos (frees up memory)
   // this will return null if we're full, in which case the client code
   // should transfer the headers and retry.
   nsIImapHeaderInfo *StartNewHdr();
@@ -129,17 +129,17 @@ class nsImapProtocol : public nsIImapPro
                        public nsIInputStreamCallback,
                        public nsSupportsWeakReference,
                        public nsMsgProtocol,
                        public nsIImapProtocolSink,
                        public nsIMsgAsyncPromptListener
 {
 public:
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIINPUTSTREAMCALLBACK
   nsImapProtocol();
   virtual ~nsImapProtocol();
 
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
                                         uint64_t sourceOffset, uint32_t length) MOZ_OVERRIDE;
 
   // nsIRunnable method
@@ -681,17 +681,17 @@ class nsICacheEntryDescriptor;
 class nsImapMockChannel : public nsIImapMockChannel
                         , public nsICacheListener
                         , public nsITransportEventSink
                         , public nsSupportsWeakReference
 {
 public:
   friend class nsImapProtocol;
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPMOCKCHANNEL
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUEST
   NS_DECL_NSICACHELISTENER
   NS_DECL_NSITRANSPORTEVENTSINK
 
   nsImapMockChannel();
   virtual ~nsImapMockChannel();
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -78,25 +78,23 @@ static NS_DEFINE_CID(kCacheServiceCID, N
 
 static const char sequenceString[] = "SEQUENCE";
 static const char uidString[] = "UID";
 
 static bool gInitialized = false;
 static int32_t gMIMEOnDemandThreshold = 15000;
 static bool gMIMEOnDemand = false;
 
-NS_IMPL_THREADSAFE_ADDREF(nsImapService)
-NS_IMPL_THREADSAFE_RELEASE(nsImapService)
-NS_IMPL_QUERY_INTERFACE6(nsImapService,
-                         nsIImapService,
-                         nsIMsgMessageService,
-                         nsIProtocolHandler,
-                         nsIMsgProtocolInfo,
-                         nsIMsgMessageFetchPartService,
-                         nsIContentHandler)
+NS_IMPL_ISUPPORTS6(nsImapService,
+                   nsIImapService,
+                   nsIMsgMessageService,
+                   nsIProtocolHandler,
+                   nsIMsgProtocolInfo,
+                   nsIMsgMessageFetchPartService,
+                   nsIContentHandler)
 
 nsImapService::nsImapService()
 {
   mPrintingOperation = false;
   if (!gInitialized)
   {
     nsresult rv;
     nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv)); 
--- a/mailnews/imap/src/nsImapService.h
+++ b/mailnews/imap/src/nsImapService.h
@@ -28,17 +28,17 @@ class nsImapService : public nsIImapServ
                       public nsIProtocolHandler,
                       public nsIMsgProtocolInfo,
                       public nsIContentHandler
 {
 public:
   nsImapService();
   virtual ~nsImapService();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGPROTOCOLINFO
   NS_DECL_NSIIMAPSERVICE
   NS_DECL_NSIMSGMESSAGESERVICE
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
   NS_DECL_NSICONTENTHANDLER
 
 protected:
--- a/mailnews/imap/src/nsImapUtils.cpp
+++ b/mailnews/imap/src/nsImapUtils.cpp
@@ -122,17 +122,17 @@ nsresult nsCreateImapBaseMessageURI(cons
   if (tailURI.Find(kImapRootURI) == 0)
     tailURI.Cut(0, PL_strlen(kImapRootURI));
   baseMessageURI = kImapMessageRootURI;
   baseMessageURI += tailURI;
   return NS_OK;
 }
 
 // nsImapMailboxSpec definition
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImapMailboxSpec, nsIMailboxSpec)
+NS_IMPL_ISUPPORTS1(nsImapMailboxSpec, nsIMailboxSpec)
 
 nsImapMailboxSpec::nsImapMailboxSpec()
 {
   mFolder_UIDVALIDITY = 0;
   mHighestModSeq = 0;
   mNumOfMessages = 0;
   mNumOfUnseenMessages = 0;
   mNumOfRecentMessages = 0;
--- a/mailnews/imap/src/nsImapUtils.h
+++ b/mailnews/imap/src/nsImapUtils.h
@@ -40,17 +40,17 @@ void ParseUidString(const char *uidStrin
 void AppendUid(nsCString &msgIds, uint32_t uid);
 
 class nsImapMailboxSpec : public nsIMailboxSpec
 {
 public:
   nsImapMailboxSpec();
   virtual ~nsImapMailboxSpec();
   
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMAILBOXSPEC
     
   nsImapMailboxSpec& operator= (const nsImapMailboxSpec& aCopy);
   
   nsCOMPtr<nsIImapFlagAndUidState> mFlagState;
   nsIMAPNamespace                  *mNamespaceForFolder;  
   
   uint32_t  mBoxFlags;
--- a/mailnews/imap/src/nsSyncRunnableHelpers.cpp
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.cpp
@@ -4,22 +4,22 @@
 
 #include "nsSyncRunnableHelpers.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsIMsgWindow.h"
 #include "nsImapMailFolder.h"
 
 #include "mozilla/Monitor.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(StreamListenerProxy, nsIStreamListener)
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImapMailFolderSinkProxy, nsIImapMailFolderSink)
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImapServerSinkProxy, nsIImapServerSink)
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImapMessageSinkProxy,
+NS_IMPL_ISUPPORTS1(StreamListenerProxy, nsIStreamListener)
+NS_IMPL_ISUPPORTS1(ImapMailFolderSinkProxy, nsIImapMailFolderSink)
+NS_IMPL_ISUPPORTS1(ImapServerSinkProxy, nsIImapServerSink)
+NS_IMPL_ISUPPORTS1(ImapMessageSinkProxy,
                               nsIImapMessageSink)
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImapProtocolSinkProxy,
+NS_IMPL_ISUPPORTS1(ImapProtocolSinkProxy,
                               nsIImapProtocolSink)
 namespace {
 
 // Traits class for a reference type, specialized for parameters which are
 // already references.
 template<typename T>
 struct RefType
 {
--- a/mailnews/imap/src/nsSyncRunnableHelpers.h
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.h
@@ -20,75 +20,75 @@
 
 class StreamListenerProxy : public nsIStreamListener
 {
 public:
   StreamListenerProxy(nsIStreamListener* receiver)
     : mReceiver(receiver)
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
 private:
   nsCOMPtr<nsIStreamListener> mReceiver;
 };
 
 class ImapMailFolderSinkProxy : public nsIImapMailFolderSink
 {
 public:
   ImapMailFolderSinkProxy(nsIImapMailFolderSink* receiver)
     : mReceiver(receiver)
   {
     NS_ASSERTION(receiver, "Don't allow receiver is nullptr");
   }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPMAILFOLDERSINK
 
 private:
   nsCOMPtr<nsIImapMailFolderSink> mReceiver;
 };
 
 class ImapServerSinkProxy : public nsIImapServerSink
 {
 public:
   ImapServerSinkProxy(nsIImapServerSink* receiver)
     : mReceiver(receiver)
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPSERVERSINK
 
 private:
   nsCOMPtr<nsIImapServerSink> mReceiver;
 };
 
 
 class ImapMessageSinkProxy: public nsIImapMessageSink
 {
 public:
   ImapMessageSinkProxy(nsIImapMessageSink* receiver)
     : mReceiver(receiver)
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPMESSAGESINK
 
 private:
   nsCOMPtr<nsIImapMessageSink> mReceiver;
 };
 
 class ImapProtocolSinkProxy : public nsIImapProtocolSink
 {
 public:
   ImapProtocolSinkProxy(nsIImapProtocolSink* receiver)
     : mReceiver(receiver)
   { }
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMAPPROTOCOLSINK
 
 private:
   nsCOMPtr<nsIImapProtocolSink> mReceiver;
 };
 #endif // nsSyncRunnableHelpers_h
--- a/mailnews/import/applemail/src/nsAppleMailImport.cpp
+++ b/mailnews/import/applemail/src/nsAppleMailImport.cpp
@@ -62,17 +62,17 @@ nsAppleMailImportModule::nsAppleMailImpo
 
 
 nsAppleMailImportModule::~nsAppleMailImportModule()
 {
   IMPORT_LOG0("nsAppleMailImportModule Deleted");
 }
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAppleMailImportModule, nsIImportModule)
+NS_IMPL_ISUPPORTS1(nsAppleMailImportModule, nsIImportModule)
 
 
 NS_IMETHODIMP nsAppleMailImportModule::GetName(PRUnichar **aName)
 {
   return mBundle ? 
     mBundle->GetStringFromID(APPLEMAILIMPORT_NAME, aName) : NS_ERROR_FAILURE;
 }
 
@@ -147,17 +147,17 @@ nsresult nsAppleMailImportMail::Initiali
   return bundleService->CreateBundle(APPLEMAIL_MSGS_URL, getter_AddRefs(mBundle));
 }
 
 nsAppleMailImportMail::~nsAppleMailImportMail()
 {
   IMPORT_LOG0("nsAppleMailImportMail destroyed");
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsAppleMailImportMail, nsIImportMail)
+NS_IMPL_ISUPPORTS1(nsAppleMailImportMail, nsIImportMail)
 
 NS_IMETHODIMP nsAppleMailImportMail::GetDefaultLocation(nsIFile **aLocation, bool *aFound, bool *aUserVerify)
 {
   NS_ENSURE_ARG_POINTER(aFound);
   NS_ENSURE_ARG_POINTER(aLocation);
   NS_ENSURE_ARG_POINTER(aUserVerify);
 
   *aLocation = nullptr;
--- a/mailnews/import/applemail/src/nsAppleMailImport.h
+++ b/mailnews/import/applemail/src/nsAppleMailImport.h
@@ -35,32 +35,32 @@ class nsIImportService;
 
 class nsAppleMailImportModule : public nsIImportModule
 {
   public:
 
   nsAppleMailImportModule();
   virtual ~nsAppleMailImportModule();
     
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMPORTMODULE
 
   private:
     
   nsCOMPtr<nsIStringBundle> mBundle;
 };
 
 class nsAppleMailImportMail : public nsIImportMail
 {
   public:
 
   nsAppleMailImportMail();
   virtual ~nsAppleMailImportMail();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMPORTMAIL
 
   nsresult Initialize();
 
   private:
 
   void FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
   nsresult FindMboxDirs(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
--- a/mailnews/import/eudora/src/nsEudoraCompose.cpp
+++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp
@@ -96,17 +96,17 @@ class EudoraSendListener : public nsIMsg
 public:
   EudoraSendListener() {
     m_done = false;
   }
 
   virtual ~EudoraSendListener() {}
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   /* void OnStartSending (in string aMsgID, in uint32_t aMsgSize); */
   NS_IMETHOD OnStartSending(const char *aMsgID, uint32_t aMsgSize) {return NS_OK;}
 
   /* void OnProgress (in string aMsgID, in uint32_t aProgress, in uint32_t aProgressMax); */
   NS_IMETHOD OnProgress(const char *aMsgID, uint32_t aProgress, uint32_t aProgressMax) {return NS_OK;}
 
   /* void OnStatus (in string aMsgID, in wstring aMsg); */
@@ -131,17 +131,17 @@ public:
   void Reset() { m_done = false;  m_location = nullptr;}
 
 public:
   bool m_done;
   nsCOMPtr <nsIFile> m_location;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(EudoraSendListener, nsIMsgSendListener)
+NS_IMPL_ISUPPORTS1(EudoraSendListener, nsIMsgSendListener)
 
 nsresult EudoraSendListener::CreateSendListener(nsIMsgSendListener **ppListener)
 {
   NS_ENSURE_ARG_POINTER(ppListener);
   *ppListener = new EudoraSendListener();
   NS_ENSURE_TRUE(*ppListener, NS_ERROR_OUT_OF_MEMORY);
   NS_ADDREF(*ppListener);
   return NS_OK;
--- a/mailnews/import/eudora/src/nsEudoraImport.cpp
+++ b/mailnews/import/eudora/src/nsEudoraImport.cpp
@@ -63,17 +63,17 @@ class ImportEudoraMailImpl : public nsII
 {
 public:
   ImportEudoraMailImpl();
   virtual ~ImportEudoraMailImpl();
 
   static nsresult Create(nsIImportMail** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportmail interface
 
   /* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
   NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
 
   /* nsISupportsArray FindMailboxes (in nsIFile location); */
   NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
@@ -112,17 +112,17 @@ class ImportEudoraAddressImpl : public n
 {
 public:
   ImportEudoraAddressImpl();
   virtual ~ImportEudoraAddressImpl();
 
   static nsresult Create(nsIImportAddressBooks** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportAddressBooks interface
 
   NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = true; return NS_OK;}
 
   NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
 
   NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval) { *_retval = false; return NS_OK;}
@@ -400,17 +400,17 @@ ImportEudoraMailImpl::~ImportEudoraMailI
 {
   // We're done importing mail, so nsEudoraCompose no longer needs the identity
   // that it creates when we import any mail.
   nsEudoraCompose::ReleaseIdentity();
 }
 
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportEudoraMailImpl, nsIImportMail)
+NS_IMPL_ISUPPORTS1(ImportEudoraMailImpl, nsIImportMail)
 
 NS_IMETHODIMP ImportEudoraMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found, bool *userVerify)
 {
   NS_PRECONDITION(ppLoc != nullptr, "null ptr");
   NS_PRECONDITION(found != nullptr, "null ptr");
   NS_PRECONDITION(userVerify != nullptr, "null ptr");
   if (!ppLoc || !found || !userVerify)
     return NS_ERROR_NULL_POINTER;
@@ -591,17 +591,17 @@ ImportEudoraAddressImpl::ImportEudoraAdd
 
 
 ImportEudoraAddressImpl::~ImportEudoraAddressImpl()
 {
 }
 
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportEudoraAddressImpl, nsIImportAddressBooks)
+NS_IMPL_ISUPPORTS1(ImportEudoraAddressImpl, nsIImportAddressBooks)
 
 
 NS_IMETHODIMP ImportEudoraAddressImpl::GetAutoFind(PRUnichar **description, bool *_retval)
 {
   NS_PRECONDITION(description != nullptr, "null ptr");
   NS_PRECONDITION(_retval != nullptr, "null ptr");
   if (! description || !_retval)
     return NS_ERROR_NULL_POINTER;
--- a/mailnews/import/oexpress/nsOEImport.cpp
+++ b/mailnews/import/oexpress/nsOEImport.cpp
@@ -54,17 +54,17 @@ class ImportOEMailImpl : public nsIImpor
 {
 public:
   ImportOEMailImpl();
   virtual ~ImportOEMailImpl();
 
   static nsresult Create(nsIImportMail** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportmail interface
 
   /* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
   NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
 
   /* nsISupportsArray FindMailboxes (in nsIFile location); */
   NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
@@ -93,18 +93,18 @@ private:
 class ImportOEAddressImpl : public nsIImportAddressBooks
 {
 public:
     ImportOEAddressImpl();
     virtual ~ImportOEAddressImpl();
 
   static nsresult Create(nsIImportAddressBooks** aImport);
 
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
+  // nsISupports interface
+  NS_DECL_THREADSAFE_ISUPPORTS
 
     // nsIImportAddressBooks interface
 
   NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = false; return NS_OK;}
 
   NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
 
   NS_IMETHOD GetNeedsFieldMap(nsIFile *pLoc, bool *_retval) { *_retval = false; return NS_OK;}
@@ -279,17 +279,17 @@ ImportOEMailImpl::ImportOEMailImpl()
 {
 }
 
 
 ImportOEMailImpl::~ImportOEMailImpl()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOEMailImpl, nsIImportMail)
+NS_IMPL_ISUPPORTS1(ImportOEMailImpl, nsIImportMail)
 
 NS_IMETHODIMP ImportOEMailImpl::TranslateFolderName(const nsAString & aFolderName, nsAString & _retval)
 {
   if (aFolderName.LowerCaseEqualsLiteral("deleted items"))
       _retval = NS_LITERAL_STRING(kDestTrashFolderName);
   else if (aFolderName.LowerCaseEqualsLiteral("sent items"))
       _retval = NS_LITERAL_STRING(kDestSentFolderName);
   else if (aFolderName.LowerCaseEqualsLiteral("outbox"))
@@ -473,17 +473,17 @@ ImportOEAddressImpl::ImportOEAddressImpl
 
 
 ImportOEAddressImpl::~ImportOEAddressImpl()
 {
   if (m_pWab)
     delete m_pWab;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOEAddressImpl, nsIImportAddressBooks)
+NS_IMPL_ISUPPORTS1(ImportOEAddressImpl, nsIImportAddressBooks)
 
 NS_IMETHODIMP ImportOEAddressImpl::GetDefaultLocation(nsIFile **aLocation,
                                                       bool *aFound,
                                                       bool *aUserVerify)
 {
   NS_ENSURE_ARG_POINTER(aLocation);
   NS_ENSURE_ARG_POINTER(aFound);
   NS_ENSURE_ARG_POINTER(aUserVerify);
--- a/mailnews/import/outlook/src/nsOutlookCompose.cpp
+++ b/mailnews/import/outlook/src/nsOutlookCompose.cpp
@@ -117,17 +117,17 @@ public:
   OutlookSendListener() {
     m_done = false;
     m_location = nullptr;
   }
 
   virtual ~OutlookSendListener() { NS_IF_RELEASE(m_location); }
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   /* void OnStartSending (in string aMsgID, in uint32_t aMsgSize); */
   NS_IMETHOD OnStartSending(const char *aMsgID, uint32_t aMsgSize) {return NS_OK;}
 
   /* void OnProgress (in string aMsgID, in uint32_t aProgress, in uint32_t aProgressMax); */
   NS_IMETHOD OnProgress(const char *aMsgID, uint32_t aProgress, uint32_t aProgressMax) {return NS_OK;}
 
   /* void OnStatus (in string aMsgID, in wstring aMsg); */
@@ -150,17 +150,17 @@ public:
   static nsresult CreateSendListener(nsIMsgSendListener **ppListener);
   void Reset() { m_done = false; NS_IF_RELEASE(m_location);}
 
 public:
   bool m_done;
   nsIFile * m_location;
 };
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(OutlookSendListener, nsIMsgSendListener)
+NS_IMPL_ISUPPORTS1(OutlookSendListener, nsIMsgSendListener)
 
 nsresult OutlookSendListener::CreateSendListener(nsIMsgSendListener **ppListener)
 {
   NS_PRECONDITION(ppListener != nullptr, "null ptr");
   NS_ENSURE_ARG_POINTER(ppListener);
 
   *ppListener = new OutlookSendListener();
   if (! *ppListener)
--- a/mailnews/import/outlook/src/nsOutlookImport.cpp
+++ b/mailnews/import/outlook/src/nsOutlookImport.cpp
@@ -48,17 +48,17 @@ class ImportOutlookMailImpl : public nsI
 {
 public:
   ImportOutlookMailImpl();
   virtual ~ImportOutlookMailImpl();
 
   static nsresult Create(nsIImportMail** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportmail interface
 
   /* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
   NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
 
   /* nsISupportsArray FindMailboxes (in nsIFile location); */
   NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
@@ -89,17 +89,17 @@ class ImportOutlookAddressImpl : public 
 {
 public:
   ImportOutlookAddressImpl();
   virtual ~ImportOutlookAddressImpl();
 
   static nsresult Create(nsIImportAddressBooks** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportAddressBooks interface
 
   NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = true; return NS_OK;}
 
   NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
 
   NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval) { *_retval = false; return NS_OK;}
@@ -291,17 +291,17 @@ ImportOutlookMailImpl::ImportOutlookMail
   nsOutlookCompose::CreateIdentity();
 }
 
 ImportOutlookMailImpl::~ImportOutlookMailImpl()
 {
   nsOutlookCompose::ReleaseIdentity();
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOutlookMailImpl, nsIImportMail)
+NS_IMPL_ISUPPORTS1(ImportOutlookMailImpl, nsIImportMail)
 
 NS_IMETHODIMP ImportOutlookMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found, bool *userVerify)
 {
   NS_PRECONDITION(ppLoc != nullptr, "null ptr");
   NS_PRECONDITION(found != nullptr, "null ptr");
   NS_PRECONDITION(userVerify != nullptr, "null ptr");
   if (!ppLoc || !found || !userVerify)
     return NS_ERROR_NULL_POINTER;
@@ -480,17 +480,17 @@ ImportOutlookAddressImpl::ImportOutlookA
   m_msgCount = 0;
   m_msgTotal = 0;
 }
 
 ImportOutlookAddressImpl::~ImportOutlookAddressImpl()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportOutlookAddressImpl, nsIImportAddressBooks)
+NS_IMPL_ISUPPORTS1(ImportOutlookAddressImpl, nsIImportAddressBooks)
 
 NS_IMETHODIMP ImportOutlookAddressImpl::GetAutoFind(PRUnichar **description, bool *_retval)
 {
   NS_PRECONDITION(description != nullptr, "null ptr");
   NS_PRECONDITION(_retval != nullptr, "null ptr");
   if (! description || !_retval)
     return NS_ERROR_NULL_POINTER;
 
--- a/mailnews/import/src/nsImportABDescriptor.cpp
+++ b/mailnews/import/src/nsImportABDescriptor.cpp
@@ -19,14 +19,14 @@ NS_METHOD nsImportABDescriptor::Create(n
     return NS_ERROR_OUT_OF_MEMORY;
 
   NS_ADDREF(it);
   nsresult rv = it->QueryInterface(aIID, aResult);
   NS_RELEASE(it);
   return rv;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportABDescriptor, nsIImportABDescriptor)
+NS_IMPL_ISUPPORTS1(nsImportABDescriptor, nsIImportABDescriptor)
 
 nsImportABDescriptor::nsImportABDescriptor()
   : mId(0), mRef(0), mSize(0), mImport(true)
 {
 }
--- a/mailnews/import/src/nsImportABDescriptor.h
+++ b/mailnews/import/src/nsImportABDescriptor.h
@@ -13,17 +13,17 @@
 #include "nsIFile.h"
 #include "nsCOMPtr.h"
 
 ////////////////////////////////////////////////////////////////////////
 
 class nsImportABDescriptor : public nsIImportABDescriptor
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_IMETHOD GetIdentifier(uint32_t *pIdentifier) MOZ_OVERRIDE {
     *pIdentifier = mId;
     return NS_OK;
   }
   NS_IMETHOD SetIdentifier(uint32_t ident) MOZ_OVERRIDE {
     mId = ident;
     return NS_OK;
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -36,17 +36,17 @@ class AddressThreadData;
 
 class nsImportGenericAddressBooks : public nsIImportGeneric
 {
 public:
 
   nsImportGenericAddressBooks();
   virtual ~nsImportGenericAddressBooks();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   /* nsISupports GetData (in string dataId); */
   NS_IMETHOD GetData(const char *dataId, nsISupports **_retval);
 
   NS_IMETHOD SetData(const char *dataId, nsISupports *pData);
 
   NS_IMETHOD GetStatus(const char *statusKind, int32_t *_retval);
 
@@ -165,17 +165,17 @@ nsImportGenericAddressBooks::~nsImportGe
   NS_IF_RELEASE(m_pInterface);
   NS_IF_RELEASE(m_pBooks);
   NS_IF_RELEASE(m_pSuccessLog);
   NS_IF_RELEASE(m_pErrorLog);
 }
 
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportGenericAddressBooks, nsIImportGeneric)
+NS_IMPL_ISUPPORTS1(nsImportGenericAddressBooks, nsIImportGeneric)
 
 
 NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISupports **_retval)
 {
   NS_PRECONDITION(_retval != nullptr, "null ptr");
   if (!_retval)
     return NS_ERROR_NULL_POINTER;
 
--- a/mailnews/import/src/nsImportFieldMap.cpp
+++ b/mailnews/import/src/nsImportFieldMap.cpp
@@ -25,17 +25,17 @@ NS_METHOD nsImportFieldMap::Create(nsISt
     return NS_ERROR_OUT_OF_MEMORY;
 
   NS_ADDREF(it);
   nsresult rv = it->QueryInterface(aIID, aResult);
   NS_RELEASE(it);
   return rv;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportFieldMap, nsIImportFieldMap)
+NS_IMPL_ISUPPORTS1(nsImportFieldMap, nsIImportFieldMap)
 
 NS_IMPL_GETSET(nsImportFieldMap, SkipFirstRecord, bool, m_skipFirstRecord)
 
 nsImportFieldMap::nsImportFieldMap(nsIStringBundle *aBundle)
 {
   m_numFields = 0;
   m_pFields = nullptr;
   m_pActive = nullptr;
--- a/mailnews/import/src/nsImportFieldMap.h
+++ b/mailnews/import/src/nsImportFieldMap.h
@@ -14,17 +14,17 @@
 
 ////////////////////////////////////////////////////////////////////////
 
 class nsIStringBundle;
 
 class nsImportFieldMap : public nsIImportFieldMap
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSIIMPORTFIELDMAP
 
   nsImportFieldMap(nsIStringBundle *aBundle);
   virtual ~nsImportFieldMap();
 
    static NS_METHOD Create(nsIStringBundle *aBundle, nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -52,17 +52,17 @@ class ImportThreadData;
 
 class nsImportGenericMail : public nsIImportGeneric
 {
 public:
 
   nsImportGenericMail();
   virtual ~nsImportGenericMail();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   /* nsISupports GetData (in string dataId); */
   NS_IMETHOD GetData(const char *dataId, nsISupports **_retval);
 
   NS_IMETHOD SetData(const char *dataId, nsISupports *pData);
 
   NS_IMETHOD GetStatus(const char *statusKind, int32_t *_retval);
 
@@ -204,17 +204,17 @@ nsImportGenericMail::~nsImportGenericMai
   NS_IF_RELEASE(m_pInterface);
   NS_IF_RELEASE(m_pMailboxes);
   NS_IF_RELEASE(m_pSuccessLog);
   NS_IF_RELEASE(m_pErrorLog);
 }
 
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportGenericMail, nsIImportGeneric)
+NS_IMPL_ISUPPORTS1(nsImportGenericMail, nsIImportGeneric)
 
 
 NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_retval)
 {
   nsresult rv = NS_OK;
 
   NS_PRECONDITION(_retval != nullptr, "null ptr");
   if (!_retval)
--- a/mailnews/import/src/nsImportMailboxDescriptor.cpp
+++ b/mailnews/import/src/nsImportMailboxDescriptor.cpp
@@ -22,17 +22,17 @@ NS_METHOD nsImportMailboxDescriptor::Cre
     return NS_ERROR_OUT_OF_MEMORY;
 
   NS_ADDREF(it);
   nsresult rv = it->QueryInterface(aIID, aResult);
   NS_RELEASE(it);
   return rv;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportMailboxDescriptor, nsIImportMailboxDescriptor)
+NS_IMPL_ISUPPORTS1(nsImportMailboxDescriptor, nsIImportMailboxDescriptor)
 
 nsImportMailboxDescriptor::nsImportMailboxDescriptor()
 {
   m_import = true;
   m_size = 0;
   m_depth = 0;
   m_id = 0;
         m_pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
--- a/mailnews/import/src/nsImportMailboxDescriptor.h
+++ b/mailnews/import/src/nsImportMailboxDescriptor.h
@@ -14,17 +14,17 @@
 #include "nsCOMPtr.h"
 
 ////////////////////////////////////////////////////////////////////////
 
 
 class nsImportMailboxDescriptor : public nsIImportMailboxDescriptor
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_IMETHOD  GetIdentifier(uint32_t *pIdentifier) MOZ_OVERRIDE { *pIdentifier = m_id; return NS_OK;}
   NS_IMETHOD  SetIdentifier(uint32_t ident) MOZ_OVERRIDE { m_id = ident; return NS_OK;}
 
   /* attribute unsigned long depth; */
   NS_IMETHOD  GetDepth(uint32_t *pDepth) MOZ_OVERRIDE { *pDepth = m_depth; return NS_OK;}
   NS_IMETHOD  SetDepth(uint32_t theDepth) MOZ_OVERRIDE { m_depth = theDepth; return NS_OK;}
 
--- a/mailnews/import/src/nsImportService.cpp
+++ b/mailnews/import/src/nsImportService.cpp
@@ -76,17 +76,17 @@ nsImportService::~nsImportService()
     if (m_pModules != nullptr)
         delete m_pModules;
 
   IMPORT_LOG0("* nsImport Service Deleted\n");
 }
 
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportService, nsIImportService)
+NS_IMPL_ISUPPORTS1(nsImportService, nsIImportService)
 
 
 NS_IMETHODIMP nsImportService::DiscoverModules(void)
 {
   m_didDiscovery = false;
   return DoDiscover();
 }
 
--- a/mailnews/import/src/nsImportService.h
+++ b/mailnews/import/src/nsImportService.h
@@ -21,17 +21,17 @@ class nsImportModuleList;
 
 class nsImportService : public nsIImportService
 {
 public:
 
   nsImportService();
   virtual ~nsImportService();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
     NS_DECL_NSIIMPORTSERVICE
 
 private:
     nsresult LoadModuleInfo(const char*pClsId, const char *pSupports);
   nsresult DoDiscover(void);
 
 private:
--- a/mailnews/import/text/src/nsTextImport.cpp
+++ b/mailnews/import/text/src/nsTextImport.cpp
@@ -56,17 +56,17 @@ class ImportAddressImpl : public nsIImpo
 {
 public:
   ImportAddressImpl(nsIStringBundle* aStringBundle);
 
   static nsresult Create(nsIImportAddressBooks** aImport,
                          nsIStringBundle *aStringBundle);
 
     // nsISupports interface
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     // nsIImportAddressBooks interface
     
   NS_IMETHOD GetSupportsMultiple(bool *_retval) { *_retval = false; return NS_OK;}
 
   NS_IMETHOD GetAutoFind(PRUnichar **description, bool *_retval);
 
   NS_IMETHOD GetNeedsFieldMap(nsIFile *location, bool *_retval);
@@ -213,17 +213,17 @@ nsresult ImportAddressImpl::Create(nsIIm
 }
 
 ImportAddressImpl::ImportAddressImpl(nsIStringBundle* aStringBundle) :
   m_notProxyBundle(aStringBundle)
 {
   m_haveDelim = false;
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportAddressImpl, nsIImportAddressBooks)
+NS_IMPL_ISUPPORTS1(ImportAddressImpl, nsIImportAddressBooks)
 
 
 NS_IMETHODIMP ImportAddressImpl::GetAutoFind(PRUnichar **addrDescription, bool *_retval)
 {
   NS_PRECONDITION(addrDescription != nullptr, "null ptr");
   NS_PRECONDITION(_retval != nullptr, "null ptr");
   if (! addrDescription || !_retval)
     return NS_ERROR_NULL_POINTER;
--- a/mailnews/import/vcard/src/nsVCardImport.cpp
+++ b/mailnews/import/vcard/src/nsVCardImport.cpp
@@ -36,17 +36,17 @@ class ImportVCardAddressImpl : public ns
 public:
   ImportVCardAddressImpl(nsIStringBundle* aStringBundle); 
   virtual ~ImportVCardAddressImpl();
 
   static nsresult Create(
       nsIImportAddressBooks** aImport, nsIStringBundle* aStringBundle);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportAddressBooks interface
 
   // TODO: support multiple vCard files in future - shouldn't be too hard,
   // since you just import each file in turn.
   NS_IMETHOD GetSupportsMultiple(bool *_retval)
   { *_retval = false; return NS_OK;}
 
@@ -189,17 +189,17 @@ ImportVCardAddressImpl::ImportVCardAddre
     nsIStringBundle* aStringBundle) : m_notProxyBundle(aStringBundle)
 {
 }
 
 ImportVCardAddressImpl::~ImportVCardAddressImpl()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportVCardAddressImpl, nsIImportAddressBooks)
+NS_IMPL_ISUPPORTS1(ImportVCardAddressImpl, nsIImportAddressBooks)
 
 NS_IMETHODIMP ImportVCardAddressImpl::GetAutoFind(
     PRUnichar **addrDescription, bool *_retval)
 {
   NS_ENSURE_ARG_POINTER(addrDescription);
   NS_ENSURE_ARG_POINTER(_retval);
 
   nsString str;
--- a/mailnews/import/winlivemail/nsWMImport.cpp
+++ b/mailnews/import/winlivemail/nsWMImport.cpp
@@ -47,17 +47,17 @@ class ImportWMMailImpl : public nsIImpor
 {
 public:
   ImportWMMailImpl();
   virtual ~ImportWMMailImpl();
 
   static nsresult Create(nsIImportMail** aImport);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportmail interface
 
   /* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
   NS_IMETHOD GetDefaultLocation(nsIFile **location, bool *found, bool *userVerify);
 
   /* nsISupportsArray FindMailboxes (in nsIFile location); */
   NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
@@ -173,17 +173,17 @@ nsresult ImportWMMailImpl::Create(nsIImp
 ImportWMMailImpl::ImportWMMailImpl()
 {
 }
 
 ImportWMMailImpl::~ImportWMMailImpl()
 {
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(ImportWMMailImpl, nsIImportMail)
+NS_IMPL_ISUPPORTS1(ImportWMMailImpl, nsIImportMail)
 
 NS_IMETHODIMP ImportWMMailImpl::TranslateFolderName(const nsAString & aFolderName, nsAString & _retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP ImportWMMailImpl::GetDefaultLocation(nsIFile **ppLoc, bool *found,
                                                    bool *userVerify)
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -39,17 +39,17 @@
 #include "nsMsgBaseCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIPop3Service.h"
 #include "nsMsgLocalCID.h"
 #include "mozilla/Services.h"
 
 extern PRLogModuleInfo *POP3LOGMODULE;
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsPop3Sink, nsIPop3Sink)
+NS_IMPL_ISUPPORTS1(nsPop3Sink, nsIPop3Sink)
 
 nsPop3Sink::nsPop3Sink()
 {
     m_authed = false;
     m_downloadingToTempFile = false;
     m_biffState = 0;
     m_numNewMessages = 0;
     m_numNewMessagesInFolder = 0;
--- a/mailnews/local/src/nsPop3Sink.h
+++ b/mailnews/local/src/nsPop3Sink.h
@@ -31,17 +31,17 @@ struct partialRecord
 };
 
 class nsPop3Sink : public nsIPop3Sink
 {
 public:
     nsPop3Sink();
     virtual ~nsPop3Sink();
 
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIPOP3SINK
     nsresult GetServerFolder(nsIMsgFolder **aFolder);
     nsresult FindPartialMessages();
     void CheckPartialMessages(nsIPop3Protocol *protocol);
 
     static char*  GetDummyEnvelope(void);
 
 protected:
--- a/mailnews/mapi/mapihook/src/msgMapiHook.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiHook.cpp
@@ -54,17 +54,17 @@ extern PRLogModuleInfo *MAPI;
 
 class nsMAPISendListener : public nsIMsgSendListener
 {
 public:
 
     virtual ~nsMAPISendListener() { }
 
     // nsISupports interface
-    NS_DECL_ISUPPORTS
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     /* void OnStartSending (in string aMsgID, in uint32_t aMsgSize); */
     NS_IMETHOD OnStartSending(const char *aMsgID, uint32_t aMsgSize) { return NS_OK; }
 
     /* void OnProgress (in string aMsgID, in uint32_t aProgress, in uint32_t aProgressMax); */
     NS_IMETHOD OnProgress(const char *aMsgID, uint32_t aProgress, uint32_t aProgressMax) { return NS_OK;}
 
     /* void OnStatus (in string aMsgID, in wstring aMsg); */
@@ -97,17 +97,17 @@ protected :
     nsMAPISendListener() {
         m_done = false;
     }
 
     bool            m_done;
 };
 
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMAPISendListener, nsIMsgSendListener)
+NS_IMPL_ISUPPORTS1(nsMAPISendListener, nsIMsgSendListener)
 
 nsresult nsMAPISendListener::CreateMAPISendListener( nsIMsgSendListener **ppListener)
 {
     NS_ENSURE_ARG_POINTER(ppListener) ;
 
     *ppListener = new nsMAPISendListener();
     if (! *ppListener)
         return NS_ERROR_OUT_OF_MEMORY;
--- a/mailnews/mapi/mapihook/src/msgMapiSupport.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiSupport.cpp
@@ -16,17 +16,17 @@
 #include "msgMapiSupport.h"
 
 #include "msgMapiImp.h"
 
 /** Implementation of the nsIMapiSupport interface.
  *  Use standard implementation of nsISupports stuff.
  */
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsMapiSupport, nsIMapiSupport, nsIObserver)
+NS_IMPL_ISUPPORTS2(nsMapiSupport, nsIMapiSupport, nsIObserver)
 
 NS_IMETHODIMP
 nsMapiSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
 {
     nsresult rv = NS_OK ;
 
     if (!strcmp(aTopic, "profile-after-change"))
         return InitializeMAPISupport();
--- a/mailnews/mapi/mapihook/src/msgMapiSupport.h
+++ b/mailnews/mapi/mapihook/src/msgMapiSupport.h
@@ -16,17 +16,17 @@
 class nsMapiSupport : public nsIMapiSupport,
                       public nsIObserver
 {
     public :
         nsMapiSupport();
         ~nsMapiSupport();
 
         // Declare all interface methods we must implement.
-        NS_DECL_ISUPPORTS
+        NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIOBSERVER
         NS_DECL_NSIMAPISUPPORT
 
     private :
 
         DWORD   m_dwRegister;
         CMapiFactory *m_nsMapiFactory;
 };
--- a/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
+++ b/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
@@ -217,17 +217,17 @@ MimePgpe_generate(void *output_closure)
 
 static void
 MimePgpe_free(void *output_closure)
 {
 }
 
 
 ////////////////////////////////////////////////////////////////////////////
-NS_IMPL_THREADSAFE_ISUPPORTS5(nsPgpMimeProxy,
+NS_IMPL_ISUPPORTS5(nsPgpMimeProxy,
                               nsIPgpMimeProxy,
                               nsIRequestObserver,
                               nsIStreamListener,
                               nsIRequest,
                               nsIInputStream)
 
 // nsPgpMimeProxy implementation
 nsPgpMimeProxy::nsPgpMimeProxy()
--- a/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.h
+++ b/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.h
@@ -25,17 +25,17 @@ struct MimeEncryptedPgp {
   MimeEncrypted encrypted;
 };
 
 class nsPgpMimeProxy : public nsIPgpMimeProxy,
                        public nsIRequest,
                        public nsIInputStream
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPGPMIMEPROXY
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIREQUEST
   NS_DECL_NSIINPUTSTREAM
 
   nsPgpMimeProxy();
   virtual ~nsPgpMimeProxy();
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
@@ -34,24 +34,17 @@
 #include "mozilla/Services.h"
 #include <algorithm>
 
 static PRLogModuleInfo * gMimeEmitterLogModule = nullptr;
 
 #define   MIME_HEADER_URL      "chrome://messenger/locale/mimeheader.properties"
 #define   MIME_URL             "chrome://messenger/locale/mime.properties"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMimeBaseEmitter)
-NS_IMPL_THREADSAFE_RELEASE(nsMimeBaseEmitter)
-
-NS_INTERFACE_MAP_BEGIN(nsMimeBaseEmitter)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMimeEmitter)
-   NS_INTERFACE_MAP_ENTRY(nsIMimeEmitter)
-   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS2(nsMimeBaseEmitter, nsIMimeEmitter, nsIInterfaceRequestor)
 
 nsMimeBaseEmitter::nsMimeBaseEmitter()
 {
   // Initialize data output vars...
   mFirstHeaders = true;
 
   mBufferMgr = nullptr;
   mTotalWritten = 0;
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.h
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.h
@@ -53,17 +53,17 @@ typedef struct {
 class nsMimeBaseEmitter : public nsIMimeEmitter,
                           public nsIInterfaceRequestor
 {
 public:
   nsMimeBaseEmitter ();
   virtual             ~nsMimeBaseEmitter (void);
 
   // nsISupports interface
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSIMIMEEMITTER
   NS_DECL_NSIINTERFACEREQUESTOR
 
   // Utility output functions...
   NS_IMETHOD          UtilityWrite(const nsACString &buf);
   NS_IMETHOD          UtilityWriteCRLF(const char *buf);
 
--- a/mailnews/mime/src/mimecms.cpp
+++ b/mailnews/mime/src/mimecms.cpp
@@ -216,17 +216,17 @@ bool MimeCMSHeadersAndCertsMatch(nsICMSM
   }
 
   return match;
 }
 
 class nsSMimeVerificationListener : public nsISMimeVerificationListener
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISMIMEVERIFICATIONLISTENER
 
   nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
                               const char *aSenderAddr, const char *aSenderName,
                               nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel);
 
   virtual ~nsSMimeVerificationListener() {}
   
@@ -286,17 +286,17 @@ nsresult ProxySignedStatus(const nsMainT
                            int32_t aSignatureStatus,
                            nsIX509Cert *aSignerCert)
 {
   nsRefPtr<SignedStatusRunnable> signedStatus =
     new SignedStatusRunnable(aSink, aNestingLevel, aSignatureStatus, aSignerCert);
   return NS_DispatchToMainThread(signedStatus, NS_DISPATCH_SYNC);
 }
 
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsSMimeVerificationListener, nsISMimeVerificationListener)
+NS_IMPL_ISUPPORTS1(nsSMimeVerificationListener, nsISMimeVerificationListener)
 
 nsSMimeVerificationListener::nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
                                                          const char *aSenderAddr, const char *aSenderName,
                                                          nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel)
 {
   mHeaderSink = new nsMainThreadPtrHolder<nsIMsgSMIMEHeaderSink>(aHeaderSink);
   mSinkIsNull = !aHeaderSink;
   mMimeNestingLevel = aMimeNestingLevel;
--- a/mailnews/mime/src/nsMimeConverter.cpp
+++ b/mailnews/mime/src/nsMimeConverter.cpp
@@ -7,23 +7,17 @@
 #include "modmimee.h"
 #include "nscore.h"
 #include "nsMimeConverter.h"
 #include "comi18n.h"
 #include "nsMsgI18N.h"
 #include "prmem.h"
 #include "plstr.h"
 
-NS_IMPL_THREADSAFE_ADDREF(nsMimeConverter)
-NS_IMPL_THREADSAFE_RELEASE(nsMimeConverter)
-
-NS_INTERFACE_MAP_BEGIN(nsMimeConverter)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMimeConverter)
-   NS_INTERFACE_MAP_ENTRY(nsIMimeConverter)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS1(nsMimeConverter, nsIMimeConverter)
 
 /*
  * nsMimeConverter definitions....
  */
 
 /* 
  * Inherited methods for nsMimeConverter
  */
--- a/mailnews/mime/src/nsMimeConverter.h
+++ b/mailnews/mime/src/nsMimeConverter.h
@@ -26,13 +26,13 @@
 #include "nsCOMPtr.h"
 
 class nsMimeConverter : public nsIMimeConverter {
 public:
   nsMimeConverter();
   virtual ~nsMimeConverter();
 
   /* this macro defines QueryInterface, AddRef and Release for this class */
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMIMECONVERTER
 };
 
 #endif /* nsMimeConverter_h_ */
--- a/mailnews/mime/src/nsStreamConverter.cpp
+++ b/mailnews/mime/src/nsStreamConverter.cpp
@@ -495,26 +495,18 @@ nsStreamConverter::nsStreamConverter()
   mPendingContext = nullptr;
 }
 
 nsStreamConverter::~nsStreamConverter()
 {
   InternalCleanup();
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsStreamConverter)
-NS_IMPL_THREADSAFE_RELEASE(nsStreamConverter)
-
-NS_INTERFACE_MAP_BEGIN(nsStreamConverter)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener)
-   NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-   NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
-   NS_INTERFACE_MAP_ENTRY(nsIStreamConverter)
-   NS_INTERFACE_MAP_ENTRY(nsIMimeStreamConverter)
-NS_INTERFACE_MAP_END
+NS_IMPL_ISUPPORTS4(nsStreamConverter, nsIStreamListener, nsIRequestObserver,
+  nsIStreamConverter, nsIMimeStreamConverter)
 
 ///////////////////////////////////////////////////////////////
 // nsStreamConverter definitions....
 ///////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutListener, nsIChannel *aChannel)
 {
   NS_ENSURE_ARG_POINTER(aURI);
--- a/mailnews/mime/src/nsStreamConverter.h
+++ b/mailnews/mime/src/nsStreamConverter.h
@@ -15,17 +15,17 @@
 #include "nsStringGlue.h"
 #include "nsCOMPtr.h"
 
 class nsStreamConverter : public nsIStreamConverter, public nsIMimeStreamConverter {
 public:
   nsStreamConverter();
   virtual ~nsStreamConverter();
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIMimeStreamConverter support
   NS_DECL_NSIMIMESTREAMCONVERTER
   // nsIStreamConverter methods
   NS_DECL_NSISTREAMCONVERTER
   // nsIStreamListener methods
   NS_DECL_NSISTREAMLISTENER
 
--- a/mailnews/news/src/nsNntpMockChannel.cpp
+++ b/mailnews/news/src/nsNntpMockChannel.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsNntpMockChannel.h"
 
 #include "msgCore.h"
 #include "nsNNTPProtocol.h"
 #include "nsNetUtil.h"
 
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsNntpMockChannel, nsIChannel, nsIRequest)
+NS_IMPL_ISUPPORTS2(nsNntpMockChannel, nsIChannel, nsIRequest)
 
 nsNntpMockChannel::nsNntpMockChannel(nsIURI *aUri, nsIMsgWindow *aMsgWindow)
 : m_url(aUri),
   m_msgWindow(aMsgWindow),
   m_channelState(CHANNEL_UNOPENED),
   m_protocol(nullptr),
   m_cancelStatus(NS_OK),
   m_loadFlags(0),
--- a/mailnews/news/src/nsNntpMockChannel.h
+++ b/mailnews/news/src/nsNntpMockChannel.h
@@ -12,17 +12,17 @@
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
 
 class nsNNTPProtocol;
 
 class nsNntpMockChannel : public nsIChannel
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSICHANNEL
   NS_DECL_NSIREQUEST
 
   nsNntpMockChannel(nsIURI *aUri, nsIMsgWindow *aMsgWindow);
   nsNntpMockChannel(nsIURI *aUri, nsIMsgWindow *aMsgWindow,
                     nsISupports *aConsumer);
   virtual ~nsNntpMockChannel();
 
--- a/mailnews/news/src/nsNntpService.cpp
+++ b/mailnews/news/src/nsNntpService.cpp
@@ -63,27 +63,19 @@ nsNntpService::nsNntpService()
   mOpenAttachmentOperation = false;
 }
 
 nsNntpService::~nsNntpService()
 {
   // do nothing
 }
 
-NS_IMPL_THREADSAFE_ADDREF(nsNntpService)
-NS_IMPL_THREADSAFE_RELEASE(nsNntpService)
-
-NS_IMPL_QUERY_INTERFACE7(nsNntpService,
-                         nsINntpService,
-                         nsIMsgMessageService,
-                         nsIProtocolHandler,
-                         nsIMsgProtocolInfo,
-                         ICOMMANDLINEHANDLER,
-                         nsIMsgMessageFetchPartService,
-                         nsIContentHandler)
+NS_IMPL_ISUPPORTS7(nsNntpService, nsINntpService, nsIMsgMessageService,
+  nsIProtocolHandler, nsIMsgProtocolInfo, nsICommandLineHandler,
+  nsIMsgMessageFetchPartService, nsIContentHandler)
 
 ////////////////////////////////////////////////////////////////////////////////////////
 // nsIMsgMessageService support
 ////////////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsNntpService::SaveMessageToDisk(const char *aMessageURI,
                                  nsIFile *aFile,
--- a/mailnews/news/src/nsNntpService.h
+++ b/mailnews/news/src/nsNntpService.h
@@ -16,32 +16,31 @@
 #include "nsIMsgProtocolInfo.h"
 #include "nsIMsgWindow.h"
 #include "nsINntpUrl.h"
 #include "nsCOMPtr.h"
 #include "nsIContentHandler.h"
 #include "nsICacheSession.h"
 
 #include "nsICommandLineHandler.h"
-#define ICOMMANDLINEHANDLER nsICommandLineHandler
 
 class nsIURI;
 class nsIUrlListener;
 
 class nsNntpService : public nsINntpService,
                       public nsIMsgMessageService,
                       public nsIMsgMessageFetchPartService,
                       public nsIProtocolHandler,
                       public nsIMsgProtocolInfo,
-                      public ICOMMANDLINEHANDLER,
+                      public nsICommandLineHandler,
                       public nsIContentHandler
 {
 public:
 
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSINNTPSERVICE
   NS_DECL_NSIMSGMESSAGESERVICE
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIMSGPROTOCOLINFO
   NS_DECL_NSICONTENTHANDLER
   NS_DECL_NSIMSGMESSAGEFETCHPARTSERVICE
   NS_DECL_NSICOMMANDLINEHANDLER