Bug 1212462 - Rename nsRefPtr<T> to RefPtr<T> due to mozilla-central Bug 1207245 rs=Ratty a=Ratty bustage fix CLOSED TREE
authorFrank-Rainer Grahl frgrahl@gmx.net
Mon, 19 Oct 2015 03:17:36 +0800
changeset 20909 9579c61e62f5bdf1ac39e97074fec5b259d80256
parent 20908 dff28c2b43af5b1df1bab8efec9f3153433f0e1e
child 20910 15fa117f0444d6cb96325c42f6264d5834fbf890
push id1553
push usermbanner@mozilla.com
push dateThu, 29 Oct 2015 19:32:44 +0000
treeherdercomm-aurora@0747078f71e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty, Ratty
bugs1212462, 1207245
Bug 1212462 - Rename nsRefPtr<T> to RefPtr<T> due to mozilla-central Bug 1207245 rs=Ratty a=Ratty bustage fix CLOSED TREE
im/components/mintrayr/trayToolkit.cpp
ldap/xpcom/src/nsLDAPConnection.cpp
ldap/xpcom/src/nsLDAPConnection.h
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPOperation.h
mail/components/search/nsMailWinSearchHelper.cpp
mailnews/addrbook/src/nsAddbookUrl.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/base/search/src/nsMsgFilterService.cpp
mailnews/base/search/src/nsMsgSearchSession.cpp
mailnews/base/search/src/nsMsgSearchSession.h
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/base/src/nsMsgAccountManager.h
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsMsgFolderCompactor.h
mailnews/base/src/nsMsgPrintEngine.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/build/nsMailModule.cpp
mailnews/compose/public/nsIMsgSend.idl
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgCopy.cpp
mailnews/compose/src/nsMsgSend.cpp
mailnews/compose/src/nsMsgSend.h
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsSmtpUrl.cpp
mailnews/compose/src/nsURLFetcher.h
mailnews/db/msgdb/public/nsMsgDatabase.h
mailnews/db/msgdb/public/nsMsgThread.h
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/db/msgdb/src/nsMsgHdr.cpp
mailnews/imap/src/nsAutoSyncState.cpp
mailnews/imap/src/nsIMAPBodyShell.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapMailFolder.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsImapServerResponseParser.h
mailnews/imap/src/nsSyncRunnableHelpers.cpp
mailnews/imap/test/TestImapFlagAndUidState.cpp
mailnews/imap/test/TestImapHdrXferInfo.cpp
mailnews/import/src/nsImportMail.cpp
mailnews/import/src/nsImportService.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsLocalMailFolder.h
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsMovemailService.cpp
mailnews/local/src/nsMsgBrkMBoxStore.cpp
mailnews/local/src/nsMsgMaildirStore.cpp
mailnews/local/src/nsParseMailbox.h
mailnews/local/src/nsPop3IncomingServer.cpp
mailnews/local/src/nsPop3Service.cpp
mailnews/local/src/nsPop3Sink.h
mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
mailnews/mime/src/mimecms.cpp
mailnews/mime/src/nsSimpleMimeConverterStub.cpp
mailnews/news/src/nsNNTPArticleList.cpp
mailnews/news/src/nsNntpIncomingServer.cpp
mailnews/news/src/nsNntpIncomingServer.h
--- a/im/components/mintrayr/trayToolkit.cpp
+++ b/im/components/mintrayr/trayToolkit.cpp
@@ -311,17 +311,17 @@ NS_IMETHODIMP TrayServiceImpl::CreateIco
     if (domWindow != aWindow) {
       continue;
     }
     *aResult = mIcons[i];
     NS_ADDREF(*aResult);
     return NS_OK;
   }
 
-  nsRefPtr<TrayIconImpl> icon = new TrayIconImpl(this);
+  RefPtr<TrayIconImpl> icon = new TrayIconImpl(this);
   rv = icon->Init(aWindow, aCloseOnRestore);
   if (NS_SUCCEEDED(rv)) {
     mIcons.AppendObject(icon);
     if (aResult) {
       icon.forget(aResult);
     }
   }
   return rv;
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -389,17 +389,17 @@ class nsOnLDAPMessageRunnable : public n
 {
 public:
   nsOnLDAPMessageRunnable(nsLDAPMessage *aMsg, bool aClear)
     : m_msg(aMsg)
     , m_clear(aClear)
   {}
   NS_DECL_NSIRUNNABLE
 private:
-  nsRefPtr<nsLDAPMessage> m_msg;
+  RefPtr<nsLDAPMessage> m_msg;
   bool m_clear;
 };
 
 NS_IMETHODIMP nsOnLDAPMessageRunnable::Run()
 {
   // get the message listener object.
   nsLDAPOperation *nsoperation = static_cast<nsLDAPOperation *>(m_msg->mOperation.get());
   nsCOMPtr<nsILDAPMessageListener> listener;
@@ -440,17 +440,17 @@ nsLDAPConnection::InvokeMessageCallback(
   }
 
   NS_ENSURE_TRUE(operation, NS_ERROR_NULL_POINTER);
 
   nsLDAPMessage *msg = static_cast<nsLDAPMessage *>(aMsg);
   msg->mOperation = operation;
 
   // proxy the listener callback to the ui thread.
-  nsRefPtr<nsOnLDAPMessageRunnable> runnable =
+  RefPtr<nsOnLDAPMessageRunnable> runnable =
     new nsOnLDAPMessageRunnable(msg, aRemoveOpFromConnQ);
   // invoke the callback
   NS_DispatchToMainThread(runnable);
 
   // if requested (ie the operation is done), remove the operation
   // from the connection queue.
   if (aRemoveOpFromConnQ)
   {
@@ -631,17 +631,17 @@ NS_IMETHODIMP nsLDAPConnectionRunnable::
 {
   if (!mOperationID) {
     NS_ERROR("mOperationID is null");
     return NS_ERROR_NULL_POINTER;
   }
 
   LDAPMessage *msgHandle;
   bool operationFinished = true;
-  nsRefPtr<nsLDAPMessage> msg;
+  RefPtr<nsLDAPMessage> msg;
 
   struct timeval timeout = { 0, 0 };
 
   nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
   int32_t returnCode = ldap_result(mConnection->mConnectionHandle, mOperationID, LDAP_MSG_ONE, &timeout, &msgHandle);
   switch (returnCode)
   {
     // timeout
--- a/ldap/xpcom/src/nsLDAPConnection.h
+++ b/ldap/xpcom/src/nsLDAPConnection.h
@@ -115,15 +115,15 @@ public:
   nsLDAPConnectionRunnable(int32_t aOperationID,
                            nsILDAPOperation *aOperation,
                            nsLDAPConnection *aConnection);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   int32_t mOperationID;
-  nsRefPtr<nsLDAPConnection> mConnection;
+  RefPtr<nsLDAPConnection> mConnection;
 
 private:
   virtual ~nsLDAPConnectionRunnable();
 };
 
 #endif // _nsLDAPConnection_h_
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -252,17 +252,17 @@ nsLDAPOperation::SaslStep(const char *to
 }
 
 
 // wrapper for ldap_simple_bind()
 //
 NS_IMETHODIMP
 nsLDAPOperation::SimpleBind(const nsACString& passwd)
 {
-    nsRefPtr<nsLDAPConnection> connection = mConnection;
+    RefPtr<nsLDAPConnection> connection = mConnection;
     // There is a possibilty that mConnection can be cleared by another
     // thread. Grabbing a local reference to mConnection may avoid this.
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=557928#c1
     nsresult rv;
     nsAutoCString bindName;
     int32_t originalMsgID = mMsgID;
     // Ugly hack alert:
     // the first time we get called with a passwd, remember it.
@@ -281,17 +281,17 @@ nsLDAPOperation::SimpleBind(const nsACSt
         return rv;
 
     MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::SimpleBind(): called; bindName = '%s'; ",
             bindName.get()));
 
     // this (nsLDAPOperation) may be released by RemovePendingOperation()
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=1063829.
-    nsRefPtr<nsLDAPOperation> kungFuDeathGrip = this;
+    RefPtr<nsLDAPOperation> kungFuDeathGrip = this;
 
     // If this is a second try at binding, remove the operation from pending ops
     // because msg id has changed...
     if (originalMsgID)
       connection->RemovePendingOperation(originalMsgID);
 
     mMsgID = ldap_simple_bind(mConnectionHandle, bindName.get(),
                               mSavePassword.get());
--- a/ldap/xpcom/src/nsLDAPOperation.h
+++ b/ldap/xpcom/src/nsLDAPOperation.h
@@ -84,17 +84,17 @@ class nsLDAPOperation : public nsILDAPOp
     /**
      * Helper function to copy the values of an nsILDAPModification into an
      * array of berval's.
      */
     static nsresult CopyValues(nsILDAPModification* aMod, berval*** aBValues);
 
     nsCOMPtr<nsILDAPMessageListener> mMessageListener; // results go here
     nsCOMPtr<nsISupports> mClosure;  // private parameter (anything caller desires)
-    nsRefPtr<nsLDAPConnection> mConnection; // connection this op is on
+    RefPtr<nsLDAPConnection> mConnection; // connection this op is on
 
     LDAP *mConnectionHandle; // cache connection handle
     nsCString mSavePassword;
     nsCString mMechanism;
     nsCOMPtr<nsIAuthModule> mAuthModule;
     int32_t mMsgID;          // opaque handle to outbound message for this op
 
     nsCOMPtr<nsIMutableArray> mClientControls;
--- a/mail/components/search/nsMailWinSearchHelper.cpp
+++ b/mail/components/search/nsMailWinSearchHelper.cpp
@@ -53,27 +53,27 @@ NS_IMETHODIMP nsMailWinSearchHelper::Get
 
   // If the service isn't present or running, we shouldn't proceed.
   bool serviceRunning;
   nsresult rv = GetServiceRunning(&serviceRunning);
   if (!serviceRunning || NS_FAILED(rv))
     return rv;
 
   // We need to do this every time so that we have the latest data
-  nsRefPtr<ISearchManager> searchManager;
+  RefPtr<ISearchManager> searchManager;
   HRESULT hr = CoCreateInstance(CLSID_CSearchManager, NULL, CLSCTX_ALL, IID_ISearchManager, getter_AddRefs(searchManager));
   if (FAILED(hr))
     return NS_ERROR_FAILURE;
 
-  nsRefPtr<ISearchCatalogManager> catalogManager;
+  RefPtr<ISearchCatalogManager> catalogManager;
   hr = searchManager->GetCatalog(L"SystemIndex", getter_AddRefs(catalogManager));
   if (FAILED(hr))
     return NS_ERROR_FAILURE;
 
-  nsRefPtr<ISearchCrawlScopeManager> crawlScopeManager;
+  RefPtr<ISearchCrawlScopeManager> crawlScopeManager;
   hr = catalogManager->GetCrawlScopeManager(getter_AddRefs(crawlScopeManager));
   if (FAILED(hr))
     return NS_ERROR_FAILURE;
 
   // We need to create appropriate URLs to check with the crawl scope manager.
   for (uint32_t i = 0; i < MOZ_ARRAY_LENGTH(sFoldersToIndex); i++)
   {
     nsCOMPtr<nsIFile> subdir;
@@ -186,34 +186,34 @@ NS_IMETHODIMP nsMailWinSearchHelper::Set
 }
 
 NS_IMETHODIMP nsMailWinSearchHelper::GetIsFileAssociationSet(bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = false;
 
   // We'll use the Vista method here
-  nsRefPtr<IApplicationAssociationRegistration> pAAR;
+  RefPtr<IApplicationAssociationRegistration> pAAR;
   HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
                                 NULL,
                                 CLSCTX_INPROC,
                                 IID_IApplicationAssociationRegistration,
                                 getter_AddRefs(pAAR));
 
   BOOL res;
   if (SUCCEEDED(hr))
     pAAR->QueryAppIsDefault(L".wdseml", AT_FILEEXTENSION, AL_EFFECTIVE, APP_REG_NAME_MAIL, &res);
   *aResult = res;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMailWinSearchHelper::SetFileAssociation()
 {
-  nsRefPtr<IApplicationAssociationRegistration> pAAR;
+  RefPtr<IApplicationAssociationRegistration> pAAR;
   HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
                                 NULL,
                                 CLSCTX_INPROC,
                                 IID_IApplicationAssociationRegistration,
                                 getter_AddRefs(pAAR));
   if (SUCCEEDED(hr))
     hr = pAAR->SetAppAsDefault(APP_REG_NAME_MAIL, L".wdseml", AT_FILEEXTENSION);
 
--- a/mailnews/addrbook/src/nsAddbookUrl.cpp
+++ b/mailnews/addrbook/src/nsAddbookUrl.cpp
@@ -182,17 +182,17 @@ NS_IMETHODIMP nsAddbookUrl::Equals(nsIUR
 
   return m_baseURL->Equals(other, _retval);
 }
 
 NS_IMETHODIMP nsAddbookUrl::Clone(nsIURI **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
-  nsRefPtr<nsAddbookUrl> clone = new nsAddbookUrl();
+  RefPtr<nsAddbookUrl> clone = new nsAddbookUrl();
 
   if (!clone)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
   NS_ENSURE_SUCCESS(rv, rv);
   clone->ParseUrl();
   clone.forget(_retval);
@@ -228,17 +228,17 @@ NS_IMETHODIMP nsAddbookUrl::EqualsExcept
   return m_baseURL->EqualsExceptRef(other, _retval);
 }
 
 NS_IMETHODIMP
 nsAddbookUrl::CloneIgnoringRef(nsIURI** _retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
-  nsRefPtr<nsAddbookUrl> clone = new nsAddbookUrl();
+  RefPtr<nsAddbookUrl> clone = new nsAddbookUrl();
 
   if (!clone)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = m_baseURL->CloneIgnoringRef(getter_AddRefs(clone->m_baseURL));
   NS_ENSURE_SUCCESS(rv, rv);
   clone->ParseUrl();
   clone.forget(_retval);
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -2506,17 +2506,17 @@ public:
     NS_DECL_NSISIMPLEENUMERATOR
     NS_DECL_NSIADDRDBLISTENER
     // nsAddrDBEnumerator methods:
 
     nsAddrDBEnumerator(nsAddrDatabase* aDb);
     void Clear();
 protected:
     virtual ~nsAddrDBEnumerator();
-    nsRefPtr<nsAddrDatabase> mDb;
+    RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbTableRowCursor> mRowCursor;
     nsCOMPtr<nsIMdbRow> mCurrentRow;
     mdb_pos mRowPos;
 };
 
 nsAddrDBEnumerator::nsAddrDBEnumerator(nsAddrDatabase* aDb)
     : mDb(aDb),
@@ -2672,17 +2672,17 @@ public:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsListAddressEnumerator methods:
 
     nsListAddressEnumerator(nsAddrDatabase* aDb, mdb_id aRowID);
 
 protected:
     ~nsListAddressEnumerator() {}
-    nsRefPtr<nsAddrDatabase> mDb;
+    RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbRow> mListRow;
     mdb_id mListRowID;
     uint32_t mAddressTotal;
     uint16_t mAddressPos;
 };
 
 nsListAddressEnumerator::nsListAddressEnumerator(nsAddrDatabase* aDb,
--- a/mailnews/base/search/src/nsMsgFilterService.cpp
+++ b/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -101,17 +101,17 @@ NS_IMETHODIMP nsMsgFilterService::OpenFi
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsCOMPtr<nsIInputStream> fileStream;
   rv = NS_NewLocalFileInputStream(getter_AddRefs(fileStream), aFilterFile);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(fileStream, NS_ERROR_OUT_OF_MEMORY);
 
-  nsRefPtr<nsMsgFilterList> filterList = new nsMsgFilterList();
+  RefPtr<nsMsgFilterList> filterList = new nsMsgFilterList();
   NS_ENSURE_TRUE(filterList, NS_ERROR_OUT_OF_MEMORY);
   filterList->SetFolder(rootFolder);
 
   // temporarily tell the filter where its file path is
   filterList->SetDefaultFile(aFilterFile);
 
   int64_t size = 0;
   rv = aFilterFile->GetFileSize(&size);
@@ -906,17 +906,17 @@ NS_IMETHODIMP
 nsMsgFilterService::ApplyFiltersToFolders(nsIMsgFilterList *aFilterList,
                                           nsIArray *aFolders,
                                           nsIMsgWindow *aMsgWindow,
                                           nsIMsgOperationListener *aCallback)
 {
   NS_ENSURE_ARG_POINTER(aFilterList);
   NS_ENSURE_ARG_POINTER(aFolders);
 
-  nsRefPtr<nsMsgFilterAfterTheFact> filterExecutor =
+  RefPtr<nsMsgFilterAfterTheFact> filterExecutor =
     new nsMsgFilterAfterTheFact(aMsgWindow, aFilterList, aFolders, aCallback);
   if (filterExecutor)
     return filterExecutor->AdvanceToNextFolder();
   else
     return NS_ERROR_OUT_OF_MEMORY;
 }
 
 NS_IMETHODIMP nsMsgFilterService::AddCustomAction(nsIMsgFilterCustomAction *aAction)
@@ -1107,17 +1107,17 @@ NS_IMETHODIMP nsMsgFilterService::ApplyF
 
   nsCOMPtr<nsIMutableArray> folderList(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   folderList->AppendElement(aFolder, false);
 
   // Create our nsMsgApplyFiltersToMessages object which will be called when ApplyFiltersToHdr
   // finds one or more filters that hit.
-  nsRefPtr<nsMsgApplyFiltersToMessages> filterExecutor =
+  RefPtr<nsMsgApplyFiltersToMessages> filterExecutor =
     new nsMsgApplyFiltersToMessages(aMsgWindow, filterList, folderList,
                                     aMsgHdrList, aFilterType, aCallback);
 
   if (filterExecutor)
     return filterExecutor->AdvanceToNextFolder();
 
   return NS_ERROR_OUT_OF_MEMORY;
 }
--- a/mailnews/base/search/src/nsMsgSearchSession.cpp
+++ b/mailnews/base/search/src/nsMsgSearchSession.cpp
@@ -528,17 +528,17 @@ NS_IMETHODIMP nsMsgSearchSession::AddSea
   m_iListener = -1;
   return NS_OK;
 }
 
 nsresult nsMsgSearchSession::NotifyListenersDone(nsresult aStatus)
 {
   // need to stabilize "this" in case one of the listeners releases the last
   // reference to us.
-  nsRefPtr<nsIMsgSearchSession> kungFuDeathGrip(this);
+  RefPtr<nsIMsgSearchSession> kungFuDeathGrip(this);
 
   nsCOMPtr<nsIMsgSearchNotify> listener;
   m_iListener = 0;
   while (m_iListener != -1 && m_iListener < (signed)m_listenerList.Length())
   {
     listener = m_listenerList[m_iListener];
     int32_t listenerFlags = m_listenerFlagList[m_iListener++];
     if (!listenerFlags || (listenerFlags & nsIMsgSearchSession::onSearchDone))
--- a/mailnews/base/search/src/nsMsgSearchSession.h
+++ b/mailnews/base/search/src/nsMsgSearchSession.h
@@ -42,17 +42,17 @@ protected:
   nsresult BeginSearching();
   nsresult DoNextSearch();
   nsresult SearchWOUrls ();
   nsresult GetNextUrl();
   nsresult NotifyListenersDone(nsresult status);
   void EnableFolderNotifications(bool aEnable);
   void ReleaseFolderDBRef();
 
-  nsTArray<nsRefPtr<nsMsgSearchScopeTerm>> m_scopeList;
+  nsTArray<RefPtr<nsMsgSearchScopeTerm>> m_scopeList;
   nsCOMPtr <nsISupportsArray> m_termList;
 
   nsTArray<nsCOMPtr<nsIMsgSearchNotify> > m_listenerList;
   nsTArray<int32_t> m_listenerFlagList;
   /**
    * Iterator index for m_listenerList/m_listenerFlagList.  We used to use an
    * nsTObserverArray for m_listenerList but its auto-adjusting iterator was
    * not helping us keep our m_listenerFlagList iterator correct.
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -637,17 +637,17 @@ nsresult nsMessenger::SaveAttachment(nsI
   nsSaveAllAttachmentsState *saveState= (nsSaveAllAttachmentsState*) closure;
   nsCOMPtr<nsIMsgMessageFetchPartService> fetchService;
   nsAutoCString urlString;
   nsCOMPtr<nsIURI> URL;
   nsAutoCString fullMessageUri(aMessageUri);
 
   // This instance will be held onto by the listeners, and will be released once 
   // the transfer has been completed.
-  nsRefPtr<nsSaveMsgListener> saveListener(new nsSaveMsgListener(aFile, this, aListener));
+  RefPtr<nsSaveMsgListener> saveListener(new nsSaveMsgListener(aFile, this, aListener));
   if (!saveListener)
     return NS_ERROR_OUT_OF_MEMORY;
 
   saveListener->m_contentType = aContentType;
   if (saveState)
   {
     saveListener->m_saveAllAttachmentsState = saveState;
     if (saveState->m_detachingAttachments)
@@ -1039,17 +1039,17 @@ nsMessenger::SaveAs(const nsACString& aU
 
     rv = PromptIfFileExists(saveAsFile);
     if (NS_FAILED(rv)) {
       goto done;
     }
 
     // After saveListener goes out of scope, the listener will be owned by
     // whoever the listener is registered with, usually a URL.
-    nsRefPtr<nsSaveMsgListener> saveListener = new nsSaveMsgListener(saveAsFile, this, nullptr);
+    RefPtr<nsSaveMsgListener> saveListener = new nsSaveMsgListener(saveAsFile, this, nullptr);
     if (!saveListener) {
       rv = NS_ERROR_OUT_OF_MEMORY;
       goto done;
     }
     rv = saveListener->QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
     if (NS_FAILED(rv))
       goto done;
 
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -184,18 +184,18 @@ nsresult nsMsgAccountManager::Shutdown()
 
   nsresult rv;
 
   SaveVirtualFolders();
 
   nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
   if (msgDBService)
   {
-    nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
-    nsRefPtr<VirtualFolderChangeListener> listener;
+    nsTObserverArray<RefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
+    RefPtr<VirtualFolderChangeListener> listener;
 
     while (iter.HasMore())
     {
       listener = iter.GetNext();
       msgDBService->UnregisterPendingListener(listener);
     }
   }
   if(m_msgFolderCache)
@@ -2586,17 +2586,17 @@ public:
   NS_IMETHOD Run()
   {
     if (mVFChangeListener)
       mVFChangeListener->ProcessUpdateEvent(mFolder, mDB);
     return NS_OK;
   }
 
 private:
-  nsRefPtr<VirtualFolderChangeListener> mVFChangeListener;
+  RefPtr<VirtualFolderChangeListener> mVFChangeListener;
   nsCOMPtr<nsIMsgFolder> mFolder;
   nsCOMPtr<nsIMsgDatabase> mDB;
 };
 
 NS_IMPL_ISUPPORTS(VirtualFolderChangeListener, nsIDBChangeListener)
 
 VirtualFolderChangeListener::VirtualFolderChangeListener() :
   m_searchOnMsgStatus(false), m_batchingEvents(false)
@@ -3271,17 +3271,17 @@ nsresult nsMsgAccountManager::AddVFListe
   nsCOMPtr <nsIRDFResource> resource;
 
   for (uint32_t i = 0; i < folderUris.Length(); i++)
   {
     rdf->GetResource(folderUris[i], getter_AddRefs(resource));
     nsCOMPtr <nsIMsgFolder> realFolder = do_QueryInterface(resource);
     if (!realFolder)
       continue;
-    nsRefPtr<VirtualFolderChangeListener> dbListener = new VirtualFolderChangeListener();
+    RefPtr<VirtualFolderChangeListener> dbListener = new VirtualFolderChangeListener();
     NS_ENSURE_TRUE(dbListener, NS_ERROR_OUT_OF_MEMORY);
     dbListener->m_virtualFolder = virtualFolder;
     dbListener->m_folderWatching = realFolder;
     if (NS_FAILED(dbListener->Init()))
     {
       dbListener = nullptr;
       continue;
     }
@@ -3295,18 +3295,18 @@ nsresult nsMsgAccountManager::AddVFListe
 // has gone away.
 nsresult nsMsgAccountManager::RemoveVFListenerForVF(nsIMsgFolder *virtualFolder,
                                                     nsIMsgFolder *folder)
 {
   nsresult rv;
   nsCOMPtr<nsIMsgDBService> msgDBService(do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
-  nsRefPtr<VirtualFolderChangeListener> listener;
+  nsTObserverArray<RefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
+  RefPtr<VirtualFolderChangeListener> listener;
 
   while (iter.HasMore())
   {
     listener = iter.GetNext();
     if (listener->m_folderWatching == folder &&
         listener->m_virtualFolder == virtualFolder)
     {
       msgDBService->UnregisterPendingListener(listener);
@@ -3391,18 +3391,18 @@ NS_IMETHODIMP nsMsgAccountManager::OnIte
     }
   }
   nsresult rv = NS_OK;
   // if this is a special folder, check if we have a saved search over
   // folders with this flag, and if so, add this folder to the scope.
   if (addToSmartFolders)
   {
     // quick way to enumerate the saved searches.
-    nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
-    nsRefPtr<VirtualFolderChangeListener> listener;
+    nsTObserverArray<RefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
+    RefPtr<VirtualFolderChangeListener> listener;
 
     while (iter.HasMore())
     {
       listener = iter.GetNext();
       nsCOMPtr <nsIMsgDatabase> db;
       nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
       listener->m_virtualFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
                                                       getter_AddRefs(db));
@@ -3504,18 +3504,18 @@ NS_IMETHODIMP nsMsgAccountManager::OnIte
 
   // build a "normalized" uri that we can do a find on.
   nsCString removedFolderURI;
   folder->GetURI(removedFolderURI);
   removedFolderURI.Insert('|', 0);
   removedFolderURI.Append('|');
 
   // Enumerate the saved searches.
-  nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
-  nsRefPtr<VirtualFolderChangeListener> listener;
+  nsTObserverArray<RefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
+  RefPtr<VirtualFolderChangeListener> listener;
 
   while (iter.HasMore())
   {
     listener = iter.GetNext();
     nsCOMPtr<nsIMsgDatabase> db;
     nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
     nsCOMPtr<nsIMsgFolder> savedSearch = listener->m_virtualFolder;
     savedSearch->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
@@ -3622,18 +3622,18 @@ nsMsgAccountManager::RemoveFolderFromSma
   aFolder->GetURI(removedFolderURI);
   removedFolderURI.Insert('|', 0);
   removedFolderURI.Append('|');
   uint32_t flags;
   aFolder->GetFlags(&flags);
   NS_ASSERTION(!(flags & flagsChanged), "smart folder flag should not be set");
   // Flag was removed. Look for smart folder based on that flag,
   // and remove this folder from its scope.
-  nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
-  nsRefPtr<VirtualFolderChangeListener> listener;
+  nsTObserverArray<RefPtr<VirtualFolderChangeListener> >::ForwardIterator iter(m_virtualFolderListeners);
+  RefPtr<VirtualFolderChangeListener> listener;
 
   while (iter.HasMore())
   {
     listener = iter.GetNext();
     nsCOMPtr <nsIMsgDatabase> db;
     nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
     listener->m_virtualFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo),
                                                     getter_AddRefs(db));
--- a/mailnews/base/src/nsMsgAccountManager.h
+++ b/mailnews/base/src/nsMsgAccountManager.h
@@ -93,17 +93,17 @@ private:
   nsCOMPtr <nsIMsgFolderCache> m_msgFolderCache;
   nsCOMPtr<nsIAtom> kDefaultServerAtom;
   nsCOMPtr<nsIAtom> mFolderFlagAtom;
   nsTArray<nsCOMPtr<nsIMsgAccount> > m_accounts;
   nsInterfaceHashtable<nsCStringHashKey, nsIMsgIdentity> m_identities;
   nsInterfaceHashtable<nsCStringHashKey, nsIMsgIncomingServer> m_incomingServers;
   nsCOMPtr<nsIMsgAccount> m_defaultAccount;
   nsCOMArray<nsIIncomingServerListener> m_incomingServerListeners;
-  nsTObserverArray<nsRefPtr<VirtualFolderChangeListener> > m_virtualFolderListeners;
+  nsTObserverArray<RefPtr<VirtualFolderChangeListener> > m_virtualFolderListeners;
   nsCOMPtr<nsIMsgFolder> m_folderDoingEmptyTrash;
   nsCOMPtr<nsIMsgFolder> m_folderDoingCleanupInbox;
   bool m_emptyTrashInProgress;
   bool m_cleanupInboxInProgress;
 
   nsCString mAccountKeyList;
 
   // These are static because the account manager may go away during
--- a/mailnews/base/src/nsMsgDBView.h
+++ b/mailnews/base/src/nsMsgDBView.h
@@ -488,17 +488,17 @@ private:
     NS_DECL_ISUPPORTS
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsMsgThreadEnumerator methods:
     nsMsgViewHdrEnumerator(nsMsgDBView *view);
 
-    nsRefPtr <nsMsgDBView> m_view;
+    RefPtr<nsMsgDBView> m_view;
     nsMsgViewIndex m_curHdrIndex;
 
   private:
     ~nsMsgViewHdrEnumerator();
   };
 };
 
 #endif
--- a/mailnews/base/src/nsMsgFolderCompactor.h
+++ b/mailnews/base/src/nsMsgFolderCompactor.h
@@ -55,17 +55,17 @@ protected:
 
   nsCString m_baseMessageUri; // base message uri
   nsCString m_messageUri; // current message uri being copy
   nsCOMPtr<nsIMsgFolder> m_folder; // current folder being compact
   nsCOMPtr<nsIMsgDatabase> m_db; // new database for the compact folder
   nsCOMPtr <nsIFile> m_file; // new mailbox for the compact folder
   nsCOMPtr <nsIOutputStream> m_fileStream; // output file stream for writing
   // all message keys that need to be copied over
-  nsRefPtr<nsMsgKeyArray> m_keyArray;
+  RefPtr<nsMsgKeyArray> m_keyArray;
   uint32_t m_size;
 
    // sum of the sizes of the messages, accumulated as we visit each msg.
   uint64_t m_totalMsgSize;
   // number of bytes that can be expunged while compacting.
   uint64_t m_totalExpungedBytes;
 
   uint32_t m_curIndex; // index of the current copied message key in key array
--- a/mailnews/base/src/nsMsgPrintEngine.cpp
+++ b/mailnews/base/src/nsMsgPrintEngine.cpp
@@ -654,17 +654,17 @@ public:
   NS_IMETHOD Run()
   {
     if (mMsgPrintEngine) 
       mMsgPrintEngine->PrintMsgWindow();
     return NS_OK;
   }
 
 private:
-  nsRefPtr<nsMsgPrintEngine> mMsgPrintEngine;
+  RefPtr<nsMsgPrintEngine> mMsgPrintEngine;
 };
 
 //-----------------------------------------------------------
 class nsStartNextPrintOpEvent : public nsRunnable
 {
 public:
   nsStartNextPrintOpEvent(nsMsgPrintEngine *mpe)
     : mMsgPrintEngine(mpe)
@@ -673,17 +673,17 @@ public:
   NS_IMETHOD Run()
   {
     if (mMsgPrintEngine) 
       mMsgPrintEngine->StartNextPrintOperation();
     return NS_OK;
   }
 
 private:
-  nsRefPtr<nsMsgPrintEngine> mMsgPrintEngine;
+  RefPtr<nsMsgPrintEngine> mMsgPrintEngine;
 };
 
 //-----------------------------------------------------------
 bool
 nsMsgPrintEngine::FirePrintEvent()
 {
   nsCOMPtr<nsIRunnable> event = new nsPrintMsgWindowEvent(this);
   return NS_SUCCEEDED(NS_DispatchToCurrentThread(event));
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -1443,17 +1443,17 @@ nsMsgDBFolder::AddMessageDispositionStat
     mDatabase->MarkForwarded(msgKey, true, nullptr);
   return NS_OK;
 }
 
 nsresult nsMsgDBFolder::AddMarkAllReadUndoAction(nsIMsgWindow *msgWindow,
                                                  nsMsgKey *thoseMarked,
                                                  uint32_t numMarked)
 {
-  nsRefPtr<nsMsgReadStateTxn> readStateTxn = new nsMsgReadStateTxn();
+  RefPtr<nsMsgReadStateTxn> readStateTxn = new nsMsgReadStateTxn();
   if (!readStateTxn)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = readStateTxn->Init(this, numMarked, thoseMarked);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = readStateTxn->SetTransactionType(nsIMessenger::eMarkAllMsg);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1816,17 +1816,17 @@ public:
   {
     if (mFolder)
       mFolder->HandleAutoCompactEvent(mMsgWindow);
     return NS_OK;
   }
 
 private:
   nsCOMPtr<nsIMsgWindow> mMsgWindow;
-  nsRefPtr<nsMsgDBFolder> mFolder;
+  RefPtr<nsMsgDBFolder> mFolder;
 };
 
 nsresult nsMsgDBFolder::HandleAutoCompactEvent(nsIMsgWindow *aWindow)
 {
   nsresult rv;
   nsCOMPtr<nsIMsgAccountManager> accountMgr = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   if (NS_SUCCEEDED(rv))
   {
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -2113,17 +2113,17 @@ MsgExamineForProxy(nsIChannel *channel, 
 
   nsCOMPtr<nsIProtocolProxyService> proxyService =
       do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // XXX: This "interface" ID is exposed, but it's not hooked up to the QI.
   // Until it is, use a static_cast for now.
 #if 0
-  nsRefPtr<nsProtocolProxyService> rawProxyService = do_QueryObject(proxyService, &rv);
+  RefPtr<nsProtocolProxyService> rawProxyService = do_QueryObject(proxyService, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 #else
   nsProtocolProxyService *rawProxyService = static_cast<nsProtocolProxyService*>(proxyService.get());
 #endif
 
   return rawProxyService->DeprecatedBlockingResolve(channel, 0, proxyInfo);
 }
 
@@ -2368,17 +2368,17 @@ MsgDetectCharsetFromFile(nsIFile *aFile,
   nsresult rv;
   nsCOMPtr<nsIInputStream> inputStream;
   rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), aFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (detector) {
     nsAutoCString buffer;
 
-    nsRefPtr<CharsetDetectionObserver> observer = new CharsetDetectionObserver();
+    RefPtr<CharsetDetectionObserver> observer = new CharsetDetectionObserver();
 
     rv = detector->Init(observer);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsILineInputStream> lineInputStream;
     lineInputStream = do_QueryInterface(inputStream, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
--- a/mailnews/build/nsMailModule.cpp
+++ b/mailnews/build/nsMailModule.cpp
@@ -808,17 +808,17 @@ static nsresult
 nsPgpMimeMimeContentTypeHandlerConstructor(nsISupports *aOuter,
                                          REFNSIID aIID,
                                          void **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   NS_ENSURE_FALSE(aOuter, NS_ERROR_NO_AGGREGATION);
   *aResult = nullptr;
 
-  nsRefPtr<nsMimeContentTypeHandler> inst(
+  RefPtr<nsMimeContentTypeHandler> inst(
     new nsMimeContentTypeHandler("mulitpart/encrypted",
                                  &MIME_PgpMimeCreateContentTypeHandlerClass));
 
   NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
 
   return inst->QueryInterface(aIID, aResult);
 }
 
--- a/mailnews/compose/public/nsIMsgSend.idl
+++ b/mailnews/compose/public/nsIMsgSend.idl
@@ -144,19 +144,19 @@ interface nsIMsgEmbeddedImageData : nsIS
 %{ C++
 // Forward declaration
 class nsMsgAttachmentHandler;
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
 %}
 
 [ptr] native nsMsgAttachedFile(nsMsgAttachedFile);
-[ptr] native nsMsgAttachmentHandlerArray(nsTArray<nsRefPtr<nsMsgAttachmentHandler>>);
+[ptr] native nsMsgAttachmentHandlerArray(nsTArray<RefPtr<nsMsgAttachmentHandler>>);
 
-[scriptable, uuid(648f8e40-3977-4dd8-88f1-b932bc654aef)]
+[scriptable, uuid(3fa45021-8174-478f-8c69-f3a8dc3f49fc)]
 interface nsIMsgSend : nsISupports
 {
   //
   // This is the primary interface for creating and sending RFC822 messages
   // in the new architecture. Currently, this method supports many arguments
   // that change the behavior of the operation. This will change in time to 
   // be separate calls that will be more singluar in nature.
   //
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -1167,17 +1167,17 @@ nsMsgAttachmentHandler::UrlExit(nsresult
   m_mime_delivery_state->GetProcessAttachmentsSynchronously(&processAttachmentsSynchronously);
   if (NS_SUCCEEDED(status) && processAttachmentsSynchronously)
   {
     /* Find the next attachment which has not yet been loaded,
      if any, and start it going.
      */
     uint32_t i;
     nsMsgAttachmentHandler *next = 0;
-    nsTArray<nsRefPtr<nsMsgAttachmentHandler>> *attachments;
+    nsTArray<RefPtr<nsMsgAttachmentHandler>> *attachments;
 
     m_mime_delivery_state->GetAttachmentHandlers(&attachments);
 
     for (i = 0; i < attachments->Length(); i++)
     {
       if (!(*attachments)[i]->m_done)
       {
         next = (*attachments)[i];
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1081,17 +1081,17 @@ nsresult nsMsgCompose::_SendMsg(MSG_Deli
 
       // right now, AutoSaveAsDraft is identical to SaveAsDraft as
       // far as the msg send code is concerned. This way, we don't have
       // to add an nsMsgDeliverMode for autosaveasdraft, and add cases for
       // it in the msg send code.
       if (deliverMode == nsIMsgCompDeliverMode::AutoSaveAsDraft)
         deliverMode = nsIMsgCompDeliverMode::SaveAsDraft;
 
-      nsRefPtr<nsIMsgCompose> msgCompose(this);
+      RefPtr<nsIMsgCompose> msgCompose(this);
       composeSendListener->SetMsgCompose(msgCompose);
       composeSendListener->SetDeliverMode(deliverMode);
 
       if (mProgress)
       {
         nsCOMPtr<nsIWebProgressListener> progressListener = do_QueryInterface(composeSendListener);
         mProgress->RegisterListener(progressListener);
       }
--- a/mailnews/compose/src/nsMsgCopy.cpp
+++ b/mailnews/compose/src/nsMsgCopy.cpp
@@ -238,17 +238,17 @@ nsMsgCopy::DoCopy(nsIFile *aDiskFile, ns
 
   // Check sanity
   if ((!aDiskFile) || (!dstFolder))
     return NS_ERROR_INVALID_ARG;
 
   //Call copyservice with dstFolder, disk file, and txnManager
   if(NS_SUCCEEDED(rv))
   {
-    nsRefPtr<CopyListener> copyListener = new CopyListener();
+    RefPtr<CopyListener> copyListener = new CopyListener();
     if (!copyListener)
       return NS_ERROR_OUT_OF_MEMORY;
 
     copyListener->SetMsgComposeAndSendObject(aMsgSendObj);
     nsCOMPtr<nsIThread> thread;
 
     if (aIsDraft)
     {
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -1450,17 +1450,17 @@ nsMsgComposeAndSend::GetMultipartRelated
 
   if (NS_SUCCEEDED(mEmbeddedObjectList->Count(&count)))
   {
     if (count > 0)
     {
       // preallocate space for part numbers
       m_partNumbers.SetLength(count);
       // Let parse the list to count the number of valid objects. BTW, we can remove the others from the list
-      nsRefPtr<nsMsgAttachmentData> attachment(new nsMsgAttachmentData);
+      RefPtr<nsMsgAttachmentData> attachment(new nsMsgAttachmentData);
 
       int32_t i;
       nsCOMPtr<nsIDOMNode> node;
 
       for (i = count - 1, count = 0; i >= 0; i --)
       {
         // Reset this structure to null!
 
@@ -1761,17 +1761,17 @@ nsMsgComposeAndSend::ProcessMultipartRel
   int32_t                   j = -1;
   uint32_t                  k;
   int32_t                   duplicateOf;
   domSaveStruct             *domSaveArray = nullptr;
 
    if (!mEmbeddedObjectList)
     return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
 
-  nsRefPtr<nsMsgAttachmentData> attachment(new nsMsgAttachmentData);
+  RefPtr<nsMsgAttachmentData> attachment(new nsMsgAttachmentData);
   int32_t               locCount = -1;
 
   if (multipartCount > 0)
   {
     domSaveArray = (domSaveStruct *)PR_MALLOC(sizeof(domSaveStruct) * multipartCount);
     if (!domSaveArray)
       return NS_ERROR_MIME_MPART_ATTACHMENT_ERROR;
     memset(domSaveArray, 0, sizeof(domSaveStruct) * multipartCount);
@@ -2347,17 +2347,17 @@ nsMsgComposeAndSend::HackAttachments(nsI
 
   mRemoteAttachmentCount += numAttachments;
 
   m_attachment_count = mPreloadedAttachmentCount + mRemoteAttachmentCount;
 
   uint32_t i; // counter for location in attachment array...
   // Now create the array of attachment handlers...
   for (i = 0; i < m_attachment_count; i++) {
-    nsRefPtr<nsMsgAttachmentHandler> handler = new nsMsgAttachmentHandler;
+    RefPtr<nsMsgAttachmentHandler> handler = new nsMsgAttachmentHandler;
     m_attachments.AppendElement(handler);
   }
 
   //
   // First, we need to attach the files that are defined in the comp fields...
   if (NS_FAILED(AddCompFieldLocalAttachments()))
     return NS_ERROR_INVALID_ARG;
 
@@ -4805,17 +4805,17 @@ nsresult nsMsgComposeAndSend::Abort()
 
 NS_IMETHODIMP nsMsgComposeAndSend::GetProcessAttachmentsSynchronously(bool *_retval)
 {
   NS_ENSURE_ARG(_retval);
   *_retval = m_be_synchronous_p;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMsgComposeAndSend::GetAttachmentHandlers(nsTArray<nsRefPtr<nsMsgAttachmentHandler>> **_retval)
+NS_IMETHODIMP nsMsgComposeAndSend::GetAttachmentHandlers(nsTArray<RefPtr<nsMsgAttachmentHandler>> **_retval)
 {
   NS_ENSURE_ARG(_retval);
   *_retval = &m_attachments;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgComposeAndSend::GetAttachmentCount(uint32_t *aAttachmentCount)
 {
--- a/mailnews/compose/src/nsMsgSend.h
+++ b/mailnews/compose/src/nsMsgSend.h
@@ -262,17 +262,17 @@ public:
   nsresult    SetStatusMessage(const nsString &aMsgString);     // Status message method
 
   //
   // All vars necessary for this implementation
   //
   nsMsgKey                  m_messageKey;        // jt -- Draft/Template support; newly created key
   nsCOMPtr<nsIMsgIdentity>  mUserIdentity;
   nsCString                 mAccountKey;
-  nsRefPtr<nsMsgCompFields> mCompFields;         // All needed composition fields (header, etc...)
+  RefPtr<nsMsgCompFields> mCompFields;         // All needed composition fields (header, etc...)
   nsCOMPtr<nsIFile>         mTempFile;           // our temporary file
 
   nsCOMPtr<nsIOutputStream> mOutputFile;         // the actual output file stream
   uint32_t                  mMessageWarningSize; // Warn if a message is over this size!
 
   bool                      m_dont_deliver_p;    // If set, we just return the nsIFile of the file
                                                  // created, instead of actually delivering message.
   nsMsgDeliverMode          m_deliver_mode;      // nsMsgDeliverNow, nsMsgQueueForLater, nsMsgSaveAsDraft,
@@ -298,17 +298,17 @@ public:
 
   // mapping between editor dom node indexes and saved mime part numbers.
   nsTArray<nsCString> m_partNumbers;
   //
   // These variables are needed for message Copy operations!
   //
   nsCOMPtr<nsIFile>         mCopyFile;
   nsCOMPtr<nsIFile>         mCopyFile2;
-  nsRefPtr<nsMsgCopy>       mCopyObj;
+  RefPtr<nsMsgCopy>       mCopyObj;
   bool                      mNeedToPerformSecondFCC;
   bool                      mPerformingSecondFCC;
 
   // For MHTML message creation
   nsCOMPtr<nsIEditor>       mEditor;
 
   //
   // The first attachment, if any (typed in by the user.)
@@ -316,28 +316,28 @@ public:
   char                    *m_attachment1_type;
   char                    *m_attachment1_encoding;
   nsAutoPtr<MimeEncoder>  m_attachment1_encoder;
   char                    *m_attachment1_body;
   uint32_t                m_attachment1_body_length;
   char                    *mOriginalHTMLBody;
 
   // The plaintext form of the first attachment, if needed.
-  nsRefPtr<nsMsgAttachmentHandler>  m_plaintext;
+  RefPtr<nsMsgAttachmentHandler>  m_plaintext;
 
   // The multipart/related save object for HTML text.
   nsMsgSendPart           *m_related_part;
   nsMsgSendPart           *m_related_body_part;
 
   //
   // Subsequent attachments, if any.
   //
   uint32_t                m_attachment_count;
   uint32_t                m_attachment_pending_count;
-  nsTArray< nsRefPtr<nsMsgAttachmentHandler> >  m_attachments;
+  nsTArray< RefPtr<nsMsgAttachmentHandler> >  m_attachments;
   nsresult                m_status; // in case some attachments fail but not all
 
   uint32_t                mPreloadedAttachmentCount;
   uint32_t                mRemoteAttachmentCount;
   int32_t                 mMultipartRelatedAttachmentCount; // the number of mpart related attachments, -1 means it has not been yet initialized
 
   uint32_t                mCompFieldLocalAttachments;     // the number of file:// attachments in the comp fields
   uint32_t                mCompFieldRemoteAttachments;    // the number of remote attachments in the comp fields
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -213,17 +213,17 @@ nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl
   NS_ENSURE_ARG_POINTER(aUrl);
 
   // For now, assume the url is an smtp url and load it.
   nsresult rv;
   nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(aUrl, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Create a smtp protocol instance to run the url in.
-  nsRefPtr<nsSmtpProtocol> smtpProtocol = new nsSmtpProtocol(aUrl);
+  RefPtr<nsSmtpProtocol> smtpProtocol = new nsSmtpProtocol(aUrl);
   if (!smtpProtocol)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Protocol will get destroyed when url is completed.
   rv = smtpProtocol->LoadUrl(aUrl, aConsumer);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return CallQueryInterface(smtpProtocol.get(), aRequest);
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -514,17 +514,17 @@ NS_IMETHODIMP nsMailtoUrl::Equals(nsIURI
 
   return m_baseURL->Equals(other, _retval);
 }
 
 NS_IMETHODIMP nsMailtoUrl::Clone(nsIURI **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
-  nsRefPtr<nsMailtoUrl> clone = new nsMailtoUrl();
+  RefPtr<nsMailtoUrl> clone = new nsMailtoUrl();
 
   NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
   NS_ENSURE_SUCCESS(rv, rv);
 
   clone->ParseUrl();
   clone.forget(_retval);
--- a/mailnews/compose/src/nsURLFetcher.h
+++ b/mailnews/compose/src/nsURLFetcher.h
@@ -63,17 +63,17 @@ private:
   nsCOMPtr<nsIStreamListener>     mConverter;               // the stream converter, if needed
   nsCString                  mConverterContentType;    // The content type of the converter
   bool                            mStillRunning;  // Are we still running?
   int32_t                         mTotalWritten;  // Size counter variable
   char                            *mBuffer;                 // Buffer used for reading the data
   uint32_t                        mBufferSize;              // Buffer size;
   nsCString                  mContentType;             // The content type retrieved from the server
   nsCString                  mCharset;                 // The charset retrieved from the server
-  nsRefPtr<nsMsgAttachmentHandler> mTagData;      // Tag data for callback...
+  RefPtr<nsMsgAttachmentHandler> mTagData;      // Tag data for callback...
   nsAttachSaveCompletionCallback  mCallback;      // Callback to call once the file is saved...
   nsCOMPtr<nsISupports>           mLoadCookie;    // load cookie used by the uri loader when we fetch the url
   bool                            mOnStopRequestProcessed; // used to prevent calling OnStopRequest multiple times
   bool                            mIsFile;        // This is used to check whether the URI is a local file.
 
   friend class nsURLFetcherStreamConsumer;
 }; 
 
--- a/mailnews/db/msgdb/public/nsMsgDatabase.h
+++ b/mailnews/db/msgdb/public/nsMsgDatabase.h
@@ -83,17 +83,17 @@ public:
 
     nsMsgDBEnumerator(nsMsgDatabase* db, nsIMdbTable *table,
                       nsMsgDBEnumeratorFilter filter, void* closure,
                       bool iterateForwards = true);
     void Clear();
 
     nsresult                        GetRowCursor();
     virtual nsresult                PrefetchNext();
-    nsRefPtr<nsMsgDatabase>         mDB;
+    RefPtr<nsMsgDatabase>         mDB;
     nsCOMPtr<nsIMdbTableRowCursor>  mRowCursor;
     mdb_pos                         mRowPos;
     nsCOMPtr<nsIMsgDBHdr>           mResultHdr;
     bool                            mDone;
     bool                            mNextPrefetched;
     bool                            mIterateForwards;
     nsMsgDBEnumeratorFilter         mFilter;
     nsCOMPtr <nsIMdbTable>          mTable;
@@ -419,17 +419,17 @@ public:
                                  void *arg);
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 private:
   uint32_t m_cacheSize;
-  nsRefPtr<mozilla::mailnews::MsgDBReporter> mMemReporter;
+  RefPtr<mozilla::mailnews::MsgDBReporter> mMemReporter;
 };
 
 class nsMsgRetentionSettings : public nsIMsgRetentionSettings
 {
 public:
   nsMsgRetentionSettings();
 
   NS_DECL_ISUPPORTS
--- a/mailnews/db/msgdb/public/nsMsgThread.h
+++ b/mailnews/db/msgdb/public/nsMsgThread.h
@@ -22,17 +22,17 @@ public:
   nsMsgThread(nsMsgDatabase *db, nsIMdbTable *table);
 
   friend class nsMsgThreadEnumerator;
   friend class nsMsgDatabase;
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGTHREAD
 
-  nsRefPtr<nsMsgDatabase> m_mdbDB;
+  RefPtr<nsMsgDatabase> m_mdbDB;
 
 protected:
   virtual ~nsMsgThread();
 
   void                  Init();
   void                  Clear();
   virtual nsresult      InitCachedValues();
   nsresult              ChangeChildCount(int32_t delta);
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -346,17 +346,17 @@ NS_IMETHODIMP nsMsgDBService::OpenMailDB
   nsCOMPtr <nsIFile>  dbPath;
   nsresult rv = GetSummaryFileLocation(aFolderName, getter_AddRefs(dbPath));
   NS_ENSURE_SUCCESS(rv, rv);
 
   *pMessageDB = FindInCache(dbPath);
   if (*pMessageDB)
     return NS_OK;
 
-  nsRefPtr<nsMailDatabase> msgDB = new nsMailDatabase;
+  RefPtr<nsMailDatabase> msgDB = new nsMailDatabase;
   NS_ENSURE_TRUE(msgDB, NS_ERROR_OUT_OF_MEMORY);
   rv = msgDB->Open(this, dbPath, aCreate, aLeaveInvalidDB);
   if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
     return rv;
   NS_IF_ADDREF(*pMessageDB = msgDB);
   if (aCreate && msgDB && rv == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING)
     rv = NS_OK;
   if (NS_SUCCEEDED(rv))
@@ -3028,17 +3028,17 @@ nsMsgDatabase::ReverseEnumerateMessages(
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgDatabase::GetFilterEnumerator(nsIArray *searchTerms, bool aReverse,
                                    nsISimpleEnumerator **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
-  nsRefPtr<nsMsgFilteredDBEnumerator> e = 
+  RefPtr<nsMsgFilteredDBEnumerator> e = 
     new nsMsgFilteredDBEnumerator(this, m_mdbAllMsgHeadersTable, aReverse,
                                   searchTerms);
 
   NS_ENSURE_TRUE(e, NS_ERROR_OUT_OF_MEMORY);
   nsresult rv = e->InitSearchSession(searchTerms, m_folder);
   NS_ENSURE_SUCCESS(rv, rv);
   return CallQueryInterface(e.get(), aResult);
 }
@@ -4375,17 +4375,17 @@ nsIMsgThread *  nsMsgDatabase::GetThread
       // It is fine if key was not found,
       // GetThreadForThreadId(nsMsgKey_None) returns nullptr.
       thread = GetThreadForThreadId(key);
     }
 #ifdef DEBUG_bienvenu1
     else
     {
       nsresult  rv;
-      nsRefPtr<nsMsgThread> pThread;
+      RefPtr<nsMsgThread> pThread;
 
       nsCOMPtr <nsIMdbPortTableCursor> tableCursor;
       m_mdbStore->GetPortTableCursor(GetEnv(), m_hdrRowScopeToken, m_threadTableKindToken,
                                      getter_AddRefs(tableCursor));
 
         nsCOMPtr<nsIMdbTable> table;
 
         while (true)
@@ -4972,17 +4972,17 @@ NS_IMETHODIMP nsMsgDatabase::GetNextFake
 }
 
 #ifdef DEBUG
 nsresult nsMsgDatabase::DumpContents()
 {
   nsMsgKey key;
   uint32_t i;
 
-  nsRefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
+  RefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
   if (!keys)
     return NS_ERROR_OUT_OF_MEMORY;
   nsresult rv = ListAllKeys(keys);
   uint32_t numKeys;
   keys->GetLength(&numKeys);
   for (i = 0; i < numKeys; i++) {
     key = keys->m_keys[i];
     nsIMsgDBHdr *msg = NULL;
--- a/mailnews/db/msgdb/src/nsMsgHdr.cpp
+++ b/mailnews/db/msgdb/src/nsMsgHdr.cpp
@@ -1002,26 +1002,26 @@ public:
 protected:
   virtual ~nsMsgPropertyEnumerator();
   nsCOMPtr<nsIMdbRowCellCursor> mRowCellCursor;
   nsCOMPtr<nsIMdbEnv> m_mdbEnv;
   nsCOMPtr<nsIMdbStore> m_mdbStore;
   // Hold a reference to the hdr so it will hold an xpcom reference to the
   // underlying mdb row. The row cell cursor will crash if the underlying
   // row goes away.
-  nsRefPtr<nsMsgHdr> m_hdr;
+  RefPtr<nsMsgHdr> m_hdr;
   bool mNextPrefetched;
   mdb_column mNextColumn;
 };
 
 nsMsgPropertyEnumerator::nsMsgPropertyEnumerator(nsMsgHdr* aHdr)
   :  mNextPrefetched(false),
      mNextColumn(NULL_MORK_COLUMN)
 {
-  nsRefPtr<nsMsgDatabase> mdb;
+  RefPtr<nsMsgDatabase> mdb;
   nsCOMPtr<nsIMdbRow> mdbRow;
 
   if (aHdr &&
       (mdbRow = aHdr->GetMDBRow()) &&
       (m_hdr = aHdr) &&
       (mdb = aHdr->m_mdb) &&
       (m_mdbEnv = mdb->m_mdbEnv) &&
       (m_mdbStore = mdb->m_mdbStore))
--- a/mailnews/imap/src/nsAutoSyncState.cpp
+++ b/mailnews/imap/src/nsAutoSyncState.cpp
@@ -337,17 +337,17 @@ NS_IMETHODIMP nsAutoSyncState::ProcessEx
   nsCOMPtr<nsIMsgDatabase> database;
   rv = folder->GetMsgDatabase(getter_AddRefs(database));
   if (!database)
     return NS_ERROR_FAILURE;
 
   // create a queue to process existing headers for the first time
   if (mExistingHeadersQ.IsEmpty())
   {
-    nsRefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
+    RefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
     rv = database->ListAllKeys(keys);
     NS_ENSURE_SUCCESS(rv, rv);
     keys->Sort();
     mExistingHeadersQ.AppendElements(keys->m_keys);
     mProcessPointer = 0;
   }
 
   // process the existing headers and find the messages not downloaded yet
--- a/mailnews/imap/src/nsIMAPBodyShell.cpp
+++ b/mailnews/imap/src/nsIMAPBodyShell.cpp
@@ -1248,17 +1248,17 @@ bool nsIMAPBodyShellCache::AddShellToCac
   if (FindShellForUID(shell->GetUID(), shell->GetFolderName(), shell->GetContentModified()))
     return true;
 
   // OK, so it's not in the cache currently.
 
   // First, for safety sake, remove any entry with the given UID,
   // just in case we have a collision between two messages in different
   // folders with the same UID.
-  nsRefPtr<nsIMAPBodyShell> foundShell;
+  RefPtr<nsIMAPBodyShell> foundShell;
   m_shellHash.Get(shell->GetUID(), getter_AddRefs(foundShell));
   if (foundShell)
   {
     m_shellHash.Remove(foundShell->GetUID());
     m_shellList->RemoveElement(foundShell);
   }
 
   // Add the new one to the cache
@@ -1274,17 +1274,17 @@ bool nsIMAPBodyShellCache::AddShellToCac
 
   return rv;
 
 }
 
 nsIMAPBodyShell *nsIMAPBodyShellCache::FindShellForUID(nsCString &UID, const char *mailboxName,
                                                        IMAP_ContentModifiedType modType)
 {
-  nsRefPtr<nsIMAPBodyShell> foundShell;
+  RefPtr<nsIMAPBodyShell> foundShell;
   m_shellHash.Get(UID, getter_AddRefs(foundShell));
   if (!foundShell)
     return nullptr;
   // Make sure the content-modified types are compatible.
   // This allows us to work seamlessly while people switch between
   // View Attachments Inline and View Attachments As Links.
   // Enforce the invariant that any cached shell we use
   // match the current content-modified settings.
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -784,17 +784,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFo
 
   if (!WeAreOffline())
   {
     if (hasOfflineEvents)
     {
       // hold a reference to the offline sync object. If ProcessNextOperation
       // runs a url, a reference will be added to it. Otherwise, it will get
       // destroyed when the refptr goes out of scope.
-      nsRefPtr<nsImapOfflineSync> goOnline = new nsImapOfflineSync(aMsgWindow, this, this);
+      RefPtr<nsImapOfflineSync> goOnline = new nsImapOfflineSync(aMsgWindow, this, this);
       if (goOnline)
       {
         m_urlListener = aUrlListener;
         return goOnline->ProcessNextOperation();
       }
     }
   }
 
@@ -2240,17 +2240,17 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMe
     }
   }
 
   if ((NS_SUCCEEDED(rv) && deleteImmediatelyNoTrash) || deleteModel == nsMsgImapDeleteModels::IMAPDelete )
   {
     if (allowUndo)
     {
       //need to take care of these two delete models
-      nsRefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
+      RefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
       if (!undoMsgTxn || NS_FAILED(undoMsgTxn->Init(this, &srcKeyArray, messageIds.get(), nullptr,
                                                     true, isMove)))
         return NS_ERROR_OUT_OF_MEMORY;
 
       undoMsgTxn->SetTransactionType(nsIMessenger::eDeleteMsg);
       // we're adding this undo action before the delete is successful. This is evil,
       // but 4.5 did it as well.
       nsCOMPtr <nsITransactionManager> txnMgr;
@@ -2669,17 +2669,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateIm
     {
       dbFolderInfo->GetImapUidValidity(&imapUIDValidity);
       uint64_t mailboxHighestModSeq;
       aSpec->GetHighestModSeq(&mailboxHighestModSeq);
       char intStrBuf[40];
       PR_snprintf(intStrBuf, sizeof(intStrBuf), "%llu",  mailboxHighestModSeq);
       dbFolderInfo->SetCharProperty(kModSeqPropertyName, nsDependentCString(intStrBuf));
     }
-    nsRefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
+    RefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
     if (!keys)
       return NS_ERROR_OUT_OF_MEMORY;
     rv = mDatabase->ListAllKeys(keys);
     NS_ENSURE_SUCCESS(rv, rv);
     existingKeys.AppendElements(keys->m_keys);
     mDatabase->ListAllOfflineDeletes(&existingKeys);
   }
   int32_t folderValidity;
@@ -5254,17 +5254,17 @@ nsImapMailFolder::OnStopRunningUrl(nsIUR
           {
             if (NS_SUCCEEDED(aExitCode))
             {
               nsCOMPtr<nsIMsgDatabase> srcDB;
               if (srcFolder)
                   rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
               if (NS_SUCCEEDED(rv) && srcDB)
               {
-                nsRefPtr<nsImapMoveCopyMsgTxn> msgTxn;
+                RefPtr<nsImapMoveCopyMsgTxn> msgTxn;
                 nsTArray<nsMsgKey> srcKeyArray;
                 if (m_copyState->m_allowUndo)
                 {
                   msgTxn = m_copyState->m_undoMsgTxn;
                   if (msgTxn)
                     msgTxn->GetSrcKeyArray(srcKeyArray);
                 }
                 else
@@ -5622,17 +5622,17 @@ nsImapMailFolder::RefreshFolderRights()
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsImapMailFolder::SetCopyResponseUid(const char* msgIdString,
                                      nsIImapUrl * aUrl)
 {   // CopyMessages() only
   nsresult rv = NS_OK;
-  nsRefPtr<nsImapMoveCopyMsgTxn> msgTxn;
+  RefPtr<nsImapMoveCopyMsgTxn> msgTxn;
   nsCOMPtr<nsISupports> copyState;
 
   if (aUrl)
     aUrl->GetCopyState(getter_AddRefs(copyState));
 
   if (copyState)
   {
     nsCOMPtr<nsImapMailCopyState> mailCopyState =
@@ -5640,17 +5640,17 @@ nsImapMailFolder::SetCopyResponseUid(con
     if (NS_FAILED(rv)) return rv;
     if (mailCopyState->m_undoMsgTxn)
       msgTxn = mailCopyState->m_undoMsgTxn;
   }
   else if (aUrl && m_pendingOfflineMoves.Length())
   {
     nsCString urlSourceMsgIds, undoTxnSourceMsgIds;
     aUrl->GetListOfMessageIds(urlSourceMsgIds);
-    nsRefPtr<nsImapMoveCopyMsgTxn> imapUndo = m_pendingOfflineMoves[0];
+    RefPtr<nsImapMoveCopyMsgTxn> imapUndo = m_pendingOfflineMoves[0];
     if (imapUndo)
     {
       imapUndo->GetSrcMsgIds(undoTxnSourceMsgIds);
       if (undoTxnSourceMsgIds.Equals(urlSourceMsgIds))
         msgTxn = imapUndo;
       // ### we should handle batched moves, but lets keep it simple for a2.
       m_pendingOfflineMoves.Clear();
     }
@@ -5752,17 +5752,17 @@ nsImapMailFolder::SetAppendMsgUid(nsMsgK
     aUrl->GetCopyState(getter_AddRefs(copyState));
   if (copyState)
   {
     nsCOMPtr<nsImapMailCopyState> mailCopyState = do_QueryInterface(copyState, &rv);
     if (NS_FAILED(rv)) return rv;
 
     if (mailCopyState->m_undoMsgTxn) // CopyMessages()
     {
-        nsRefPtr<nsImapMoveCopyMsgTxn> msgTxn;
+        RefPtr<nsImapMoveCopyMsgTxn> msgTxn;
         msgTxn = mailCopyState->m_undoMsgTxn;
         msgTxn->AddDstKey(aKey);
     }
     else if (mailCopyState->m_listener) // CopyFileMessage();
                                         // Draft/Template goes here
     {
       mailCopyState->m_appendUID = aKey;
       mailCopyState->m_listener->SetMessageKey(aKey);
@@ -6899,17 +6899,17 @@ nsImapMailFolder::CopyMessagesWithStream
 
   // ** jt - needs to create server to server move/copy undo msg txn
   if (m_copyState->m_allowUndo)
   {
     nsAutoCString messageIds;
     nsTArray<nsMsgKey> srcKeyArray;
     rv = BuildIdsAndKeyArray(messages, messageIds, srcKeyArray);
 
-    nsRefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
+    RefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
 
     if (!undoMsgTxn || NS_FAILED(undoMsgTxn->Init(srcFolder, &srcKeyArray, messageIds.get(), this,
                                 true, isMove)))
       return NS_ERROR_OUT_OF_MEMORY;
 
     if (isMove)
     {
       if (mFlags & nsMsgFolderFlags::Trash)
@@ -7350,22 +7350,22 @@ nsresult nsImapMailFolder::CopyMessagesO
               sourceMailDB->MarkImapDeleted(msgKey, true, nullptr); // offline delete
           }
           if (successfulCopy)
             // This is for both moves and copies
             msgHdrsCopied->AppendElement(mailHdr, false);
         }
       }
       EnableNotifications(nsIMsgFolder::allMessageCountNotifications, true, false);
-      nsRefPtr<nsImapOfflineTxn> addHdrMsgTxn = new
+      RefPtr<nsImapOfflineTxn> addHdrMsgTxn = new
         nsImapOfflineTxn(this, &addedKeys, nullptr, this, isMove, nsIMsgOfflineImapOperation::kAddedHeader,
                          addedHdrs);
       if (addHdrMsgTxn && txnMgr)
          txnMgr->DoTransaction(addHdrMsgTxn);
-      nsRefPtr<nsImapOfflineTxn> undoMsgTxn = new
+      RefPtr<nsImapOfflineTxn> undoMsgTxn = new
         nsImapOfflineTxn(srcFolder, &srcKeyArray, messageIds.get(), this,
                          isMove, moveCopyOpType, srcMsgs);
       if (undoMsgTxn)
       {
         if (isMove)
         {
           undoMsgTxn->SetTransactionType(nsIMessenger::eMoveMsg);
           nsCOMPtr<nsIMsgImapMailFolder> srcIsImap(do_QueryInterface(srcFolder));
@@ -7689,17 +7689,17 @@ nsImapMailFolder::CopyMessages(nsIMsgFol
 
     nsCOMPtr<nsISupports> copySupport = do_QueryInterface(m_copyState);
     rv = imapService->OnlineMessageCopy(srcFolder, messageIds,
                                         this, true, isMove,
                                         urlListener, nullptr,
                                         copySupport, msgWindow);
     if (NS_SUCCEEDED(rv) && m_copyState->m_allowUndo)
     {
-      nsRefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
+      RefPtr<nsImapMoveCopyMsgTxn> undoMsgTxn = new nsImapMoveCopyMsgTxn;
       if (!undoMsgTxn || NS_FAILED(undoMsgTxn->Init(srcFolder, &keyArray,
                                    messageIds.get(), this,
                                    true, isMove)))
         return NS_ERROR_OUT_OF_MEMORY;
 
       if (isMove)
       {
         if (mFlags & nsMsgFolderFlags::Trash)
@@ -7736,17 +7736,17 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLLISTENER
   NS_DECL_NSIMSGCOPYSERVICELISTENER
 
   nsresult StartNextCopy();
   nsresult AdvanceToNextFolder(nsresult aStatus);
 protected:
   ~nsImapFolderCopyState();
-  nsRefPtr<nsImapMailFolder> m_newDestFolder;
+  RefPtr<nsImapMailFolder> m_newDestFolder;
   nsCOMPtr<nsISupports> m_origSrcFolder;
   nsCOMPtr<nsIMsgFolder> m_curDestParent;
   nsCOMPtr<nsIMsgFolder> m_curSrcFolder;
   bool                    m_isMoveFolder;
   nsCOMPtr<nsIMsgCopyServiceListener> m_copySrvcListener;
   nsCOMPtr<nsIMsgWindow> m_msgWindow;
   int32_t                 m_childIndex;
   nsCOMArray<nsIMsgFolder> m_srcChildFolders;
@@ -9640,17 +9640,17 @@ nsresult nsImapMailFolder::CreatePlaybac
 }
 
 void nsImapMailFolder::PlaybackTimerCallback(nsITimer *aTimer, void *aClosure)
 {
   nsPlaybackRequest *request = static_cast<nsPlaybackRequest*>(aClosure);
   
   NS_ASSERTION(request->SrcFolder->m_pendingPlaybackReq == request, "wrong playback request pointer");
   
-  nsRefPtr<nsImapOfflineSync> offlineSync = new nsImapOfflineSync(request->MsgWindow, nullptr, request->SrcFolder, true);
+  RefPtr<nsImapOfflineSync> offlineSync = new nsImapOfflineSync(request->MsgWindow, nullptr, request->SrcFolder, true);
   if (offlineSync)
   {
     mozilla::DebugOnly<nsresult> rv = offlineSync->ProcessNextOperation();
     NS_ASSERTION(NS_SUCCEEDED(rv), "pseudo-offline playback is not successful");
   }
   
   // release request struct
   request->SrcFolder->m_pendingPlaybackReq = nullptr;
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -52,17 +52,17 @@ public:
     NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMAPMAILCOPYSTATE_IID)
 
     NS_DECL_THREADSAFE_ISUPPORTS
 
     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
+    RefPtr<nsImapMoveCopyMsgTxn> m_undoMsgTxn; // undo object with this copy operation
     nsCOMPtr<nsIMsgDBHdr> m_message; // current message to be copied
     nsCOMPtr<nsIMsgCopyServiceListener> m_listener; // listener of this copy
                                                     // operation
     nsCOMPtr<nsIFile> m_tmpFile; // temp file spec for copy operation
     nsCOMPtr<nsIMsgWindow> m_msgWindow; // msg window for copy operation
 
     nsCOMPtr<nsIMsgMessageService> m_msgService; // source folder message service; can
                                         // be Nntp, Mailbox, or Imap
@@ -476,18 +476,18 @@ protected:
   // if server supports UIDNEXT, we store it here.
   int32_t m_nextUID;
 
   int32_t  m_nextMessageByteLength;
   nsCOMPtr<nsIUrlListener> m_urlListener;
   bool m_urlRunning;
 
   // undo move/copy transaction support
-  nsRefPtr<nsMsgTxn> m_pendingUndoTxn;
-  nsRefPtr<nsImapMailCopyState> m_copyState;
+  RefPtr<nsMsgTxn> m_pendingUndoTxn;
+  RefPtr<nsImapMailCopyState> m_copyState;
   char m_hierarchyDelimiter;
   int32_t m_boxFlags;
   nsCString m_onlineFolderName;
   nsCString m_ownerUserName;  // username of the "other user," as in
   // "Other Users' Mailboxes"
 
   nsCString m_adminUrl;   // url to run to set admin privileges for this folder
   nsIMAPNamespace  *m_namespace;
@@ -512,27 +512,27 @@ protected:
 
   // determines if we are on GMail server
   bool m_isGmailServer;
   // offline imap support
   bool m_downloadingFolderForOfflineUse;
   bool m_filterListRequiresBody;
 
   // auto-sync (automatic message download) support
-  nsRefPtr<nsAutoSyncState> m_autoSyncStateObj;
+  RefPtr<nsAutoSyncState> m_autoSyncStateObj;
 
   // Quota support
   nsCString m_folderQuotaRoot;
   uint32_t m_folderQuotaUsedKB;
   uint32_t m_folderQuotaMaxKB;
 
   // Pseudo-Offline Playback support
   nsPlaybackRequest *m_pendingPlaybackReq;
   nsCOMPtr<nsITimer> m_playbackTimer;
-  nsTArray<nsRefPtr<nsImapMoveCopyMsgTxn> > m_pendingOfflineMoves;
+  nsTArray<RefPtr<nsImapMoveCopyMsgTxn> > m_pendingOfflineMoves;
   // hash table of mapping between messageids and message keys
   // for pseudo hdrs.
   nsDataHashtable<nsCStringHashKey, nsMsgKey> m_pseudoHdrs;
 
   nsTArray<nsMsgKey> m_keysToFetch;
   uint32_t m_totalKeysToFetch;
 
   /**
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -1826,17 +1826,17 @@ bool nsImapProtocol::ProcessCurrentURL()
     m_runningUrl->GetCopyState(getter_AddRefs(copyState));
   // this is so hokey...we MUST clear any local references to the url
   // BEFORE calling ReleaseUrlState
   mailnewsurl = nullptr;
 
   if (suspendUrl)
     m_imapServerSink->SuspendUrl(m_runningUrl);
   // save the imap folder sink since we need it to do the CopyNextStreamMessage
-  nsRefPtr<ImapMailFolderSinkProxy> imapMailFolderSink = m_imapMailFolderSink;
+  RefPtr<ImapMailFolderSinkProxy> imapMailFolderSink = m_imapMailFolderSink;
   // release the url as we are done with it...
   ReleaseUrlState(false);
   ResetProgressInfo();
 
   ClearFlag(IMAP_CLEAN_UP_URL_STATE);
 
   if (imapMailFolderSink)
   {
@@ -2574,17 +2574,17 @@ void nsImapProtocol::ProcessSelectedStat
               {
                 // We actually want a specific MIME part of the message.
                 // The Body Shell will generate it, even though we haven't downloaded it yet.
 
                 IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
                   IMAP_CONTENT_MODIFIED_VIEW_INLINE :
                   IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS ;
 
-                nsRefPtr<nsIMAPBodyShell> foundShell;
+                RefPtr<nsIMAPBodyShell> foundShell;
                 res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
                   GetServerStateParser().GetSelectedMailboxName(),
                   messageIdString.get(), modType, getter_AddRefs(foundShell));
                 if (!foundShell)
                 {
                   // The shell wasn't in the cache.  Deal with this case later.
                   Log("SHELL",NULL,"Loading part, shell not found in cache!");
                   //MOZ_LOG(IMAP, out, ("BODYSHELL: Loading part, shell not found in cache!"));
@@ -2645,17 +2645,17 @@ void nsImapProtocol::ProcessSelectedStat
                   !GetShouldFetchAllParts() &&
                   GetServerStateParser().ServerHasIMAP4Rev1Capability() /* &&
                 !mimePartSelectorDetected */)  // if a ?part=, don't do BS.
               {
                 // OK, we're doing bodystructure
 
                 // Before fetching the bodystructure, let's check our body shell cache to see if
                 // we already have it around.
-                nsRefPtr<nsIMAPBodyShell> foundShell;
+                RefPtr<nsIMAPBodyShell> foundShell;
                 IMAP_ContentModifiedType modType = GetShowAttachmentsInline() ?
                   IMAP_CONTENT_MODIFIED_VIEW_INLINE :
                   IMAP_CONTENT_MODIFIED_VIEW_AS_LINKS ;
 
                 bool wasStoringMsgOffline;
                 m_runningUrl->GetStoreResultsOffline(&wasStoringMsgOffline);
                 m_runningUrl->SetStoreOfflineOnFallback(wasStoringMsgOffline);
                 m_runningUrl->SetStoreResultsOffline(false);
@@ -5426,26 +5426,26 @@ void nsImapProtocol::StartCompressDeflat
     }
   }
 }
 
 nsresult nsImapProtocol::BeginCompressing()
 {
   // wrap the streams in compression layers that compress or decompress
   // all traffic.
-  nsRefPtr<nsMsgCompressIStream> new_in = new nsMsgCompressIStream();
+  RefPtr<nsMsgCompressIStream> new_in = new nsMsgCompressIStream();
   if (!new_in)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = new_in->InitInputStream(m_inputStream);
   NS_ENSURE_SUCCESS(rv, rv);
 
   m_inputStream = new_in;
 
-  nsRefPtr<nsMsgCompressOStream> new_out = new nsMsgCompressOStream();
+  RefPtr<nsMsgCompressOStream> new_out = new nsMsgCompressOStream();
   if (!new_out)
     return NS_ERROR_OUT_OF_MEMORY;
 
   rv = new_out->InitOutputStream(m_outputStream);
   NS_ENSURE_SUCCESS(rv, rv);
 
   m_outputStream = new_out;
   return rv;
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -362,20 +362,20 @@ private:
   bool         m_imapThreadIsRunning;
   void ImapThreadMainLoop(void);
   nsresult    m_connectionStatus;
   nsCString   m_connectionType;
 
   bool        m_nextUrlReadyToRun;
   nsWeakPtr   m_server;
 
-  nsRefPtr<ImapMailFolderSinkProxy> m_imapMailFolderSink;
-  nsRefPtr<ImapMessageSinkProxy>    m_imapMessageSink;
-  nsRefPtr<ImapServerSinkProxy>     m_imapServerSink;
-  nsRefPtr<ImapProtocolSinkProxy>   m_imapProtocolSink;
+  RefPtr<ImapMailFolderSinkProxy> m_imapMailFolderSink;
+  RefPtr<ImapMessageSinkProxy>    m_imapMessageSink;
+  RefPtr<ImapServerSinkProxy>     m_imapServerSink;
+  RefPtr<ImapProtocolSinkProxy>   m_imapProtocolSink;
 
   // helper function to setup imap sink interface proxies
   void SetupSinkProxy();
   // End thread support stuff
 
   bool GetDeleteIsMoveToTrash();
   bool GetShowDeletedMessages();
   nsCString m_currentCommand;
@@ -598,18 +598,18 @@ private:
   int32_t m_curFetchSize;
   bool    m_ignoreExpunges;
   eIMAPCapabilityFlags m_prefAuthMethods; // set of capability flags (in nsImapCore.h) for auth methods
   eIMAPCapabilityFlags m_failedAuthMethods; // ditto
   eIMAPCapabilityFlag m_currentAuthMethod; // exactly one capability flag, or 0
   int32_t m_socketType;
   int32_t m_chunkSize;
   int32_t m_chunkThreshold;
-  nsRefPtr <nsMsgImapLineDownloadCache> m_downloadLineCache;
-  nsRefPtr <nsMsgImapHdrXferInfo> m_hdrDownloadCache;
+  RefPtr<nsMsgImapLineDownloadCache> m_downloadLineCache;
+  RefPtr<nsMsgImapHdrXferInfo> m_hdrDownloadCache;
   nsCOMPtr <nsIImapHeaderInfo> m_curHdrInfo;
   // mapping between mailboxes and the corresponding folder flags
   nsDataHashtable<nsCStringHashKey, int32_t> m_standardListMailboxes;
   // mapping between special xlist mailboxes and the corresponding folder flags
   nsDataHashtable<nsCStringHashKey, int32_t> m_specialXListMailboxes;
 
 
   nsIImapHostSessionList * m_hostSessionList;
@@ -667,17 +667,17 @@ private:
   nsTArray<char*> *            m_deletableChildren;
   uint32_t                    m_flagChangeCount;
   PRTime                      m_lastCheckTime;
 
   bool CheckNeeded();
 
   nsString m_emptyMimePartString;
 
-  nsRefPtr<mozilla::mailnews::OAuth2ThreadHelper> mOAuth2Support;
+  RefPtr<mozilla::mailnews::OAuth2ThreadHelper> mOAuth2Support;
 };
 
 // This small class is a "mock" channel because it is a mockery of the imap channel's implementation...
 // it's a light weight channel that we can return to necko when they ask for a channel on a url before
 // we actually have an imap protocol instance around which can run the url. Please see my comments in
 // nsIImapMockChannel.idl for more details..
 //
 // Threading concern: This class lives entirely in the UI thread.
--- a/mailnews/imap/src/nsImapServerResponseParser.h
+++ b/mailnews/imap/src/nsImapServerResponseParser.h
@@ -252,17 +252,17 @@ private:
   int32_t fFetchResponseIndex;
 
   // used for aborting a fetch stream when we're pseudo-Interrupted
   int32_t numberOfCharsInThisChunk;
   int32_t charsReadSoFar;
   bool fLastChunk;
 
   // points to the current body shell, if any
-  nsRefPtr<nsIMAPBodyShell> m_shell;
+  RefPtr<nsIMAPBodyShell> m_shell;
 
   // The connection object
   nsImapProtocol &fServerConnection;
 
   nsIImapHostSessionList *fHostSessionList;
   nsTArray<nsMsgKey> fCopyResponseKeyArray;
 };
 
--- a/mailnews/imap/src/nsSyncRunnableHelpers.cpp
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.cpp
@@ -277,81 +277,81 @@ DispatchSyncRunnable(SyncRunnableBase* r
   }
   return r->Result();
 }
 
 } // anonymous namespace
 
 #define NS_SYNCRUNNABLEMETHOD0(iface, method)                       \
   NS_IMETHODIMP iface##Proxy::method() {                     \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable0<nsI##iface>                           \
       (mReceiver, &nsI##iface::method);                         \
     return DispatchSyncRunnable(r);                                 \
   }
 
 
 #define NS_SYNCRUNNABLEMETHOD1(iface, method,                       \
                                arg1)                                \
   NS_IMETHODIMP iface##Proxy::method(arg1 a1) {                     \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable1<nsI##iface, arg1>                           \
       (mReceiver, &nsI##iface::method, a1);                         \
     return DispatchSyncRunnable(r);                                 \
   }
 
 #define NS_SYNCRUNNABLEMETHOD2(iface, method,                       \
                                arg1, arg2)                          \
   NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2) {            \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable2<nsI##iface, arg1, arg2>                     \
       (mReceiver, &nsI##iface::method, a1, a2);                     \
     return DispatchSyncRunnable(r);                                 \
   }
 
 #define NS_SYNCRUNNABLEMETHOD3(iface, method,                       \
                                arg1, arg2, arg3)                    \
   NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3) {   \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable3<nsI##iface, arg1, arg2, arg3>               \
       (mReceiver, &nsI##iface::method,                              \
        a1, a2, a3);                                                 \
     return DispatchSyncRunnable(r);                                 \
   }
 
 #define NS_SYNCRUNNABLEMETHOD4(iface, method,                       \
                                arg1, arg2, arg3, arg4)              \
   NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4) { \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable4<nsI##iface, arg1, arg2, arg3, arg4>         \
       (mReceiver, &nsI##iface::method,                              \
        a1, a2, a3, a4);                                             \
     return DispatchSyncRunnable(r);                                 \
   }
 
 #define NS_SYNCRUNNABLEMETHOD5(iface, method,                       \
                                arg1, arg2, arg3, arg4, arg5)        \
   NS_IMETHODIMP iface##Proxy::method(arg1 a1, arg2 a2, arg3 a3, arg4 a4, arg5 a5) {   \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable5<nsI##iface, arg1, arg2, arg3, arg4, arg5>   \
       (mReceiver, &nsI##iface::method,                              \
        a1, a2, a3, a4, a5);                                         \
     return DispatchSyncRunnable(r);                                 \
   }
 
 #define NS_SYNCRUNNABLEATTRIBUTE(iface, attribute,                       \
                                  type)                                \
 NS_IMETHODIMP iface##Proxy::Get##attribute(type *a1) {                     \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable1<nsI##iface, type *>                           \
       (mReceiver, &nsI##iface::Get##attribute, a1);                         \
     return DispatchSyncRunnable(r);                                 \
   } \
 NS_IMETHODIMP iface##Proxy::Set##attribute(type a1) {                     \
-    nsRefPtr<SyncRunnableBase> r =                                  \
+    RefPtr<SyncRunnableBase> r =                                  \
       new SyncRunnable1<nsI##iface, type>                           \
       (mReceiver, &nsI##iface::Set##attribute, a1);                         \
     return DispatchSyncRunnable(r);                                 \
   }
 
 
 #define NS_NOTIMPLEMENTED \
   { NS_RUNTIMEABORT("Not implemented"); return NS_ERROR_UNEXPECTED; }
--- a/mailnews/imap/test/TestImapFlagAndUidState.cpp
+++ b/mailnews/imap/test/TestImapFlagAndUidState.cpp
@@ -85,17 +85,17 @@ int main(int argc, char** argv)
 
   struct msgState msgState1[] = {
   {10, kImapMsgSeenFlag, 0},
   {15, kImapMsgSeenFlag, 1},
   {16, kImapMsgSeenFlag, 2},
   {17, kImapMsgSeenFlag, 3},
   {18, kImapMsgSeenFlag, 4}};
 
-  nsRefPtr<nsImapFlagAndUidState> flagState = new nsImapFlagAndUidState(10);
+  RefPtr<nsImapFlagAndUidState> flagState = new nsImapFlagAndUidState(10);
   int32_t numMsgs = sizeof(msgState1) / sizeof(msgState1[0]);
   for (int32_t i = 0; i < numMsgs; i++)
         flagState->AddUidFlagPair(msgState1[i].uid, msgState1[i].flag,
                                   msgState1[i].index);
 
   const char * error = MainChecks(flagState, msgState1, numMsgs, 0);
   if (error)
   {
--- a/mailnews/imap/test/TestImapHdrXferInfo.cpp
+++ b/mailnews/imap/test/TestImapHdrXferInfo.cpp
@@ -91,17 +91,17 @@ int MainChecks(nsMsgImapHdrXferInfo* hdr
 // General note about return values:
 // return 1 for a setup or xpcom type failure, return 2 for a real test failure
 int main(int argc, char** argv)
 {
   ScopedXPCOM xpcom("TestImapHdrXferInfo.cpp");
   if (xpcom.failed())
     return 1;
 
-  nsRefPtr<nsMsgImapHdrXferInfo> hdrInfo = new nsMsgImapHdrXferInfo();
+  RefPtr<nsMsgImapHdrXferInfo> hdrInfo = new nsMsgImapHdrXferInfo();
   // Purposely not reference counted to ensure we get the same pointers the
   // second time round MainChecks.
   nsIImapHeaderInfo* hdrArray[kNumHdrsToXfer] = { nullptr };
 
   int result = MainChecks(hdrInfo, hdrArray, eAddNoCheck);
   if (result)
   {
     printf("TEST-UNEXPECTED-FAIL | %s | %d\n", __FILE__, result);
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -1007,17 +1007,17 @@ GetSubFoldersRunnable::GetSubFoldersRunn
 NS_IMETHODIMP GetSubFoldersRunnable::Run()
 {
   return m_folder->GetSubFolders(nullptr);
 }
 
 
 nsresult ProxyGetSubFolders(nsIMsgFolder *aFolder)
 {
-  nsRefPtr<GetSubFoldersRunnable> getSubFolders =
+  RefPtr<GetSubFoldersRunnable> getSubFolders =
     new GetSubFoldersRunnable(aFolder);
   return NS_DispatchToMainThread(getSubFolders, NS_DISPATCH_SYNC);
 }
 
 class GetChildNamedRunnable : public nsRunnable
 {
 public:
   GetChildNamedRunnable(nsIMsgFolder *aFolder, const nsAString& aName, nsIMsgFolder **aChild);
@@ -1039,17 +1039,17 @@ NS_IMETHODIMP GetChildNamedRunnable::Run
 {
   return m_folder->GetChildNamed(m_name, m_child);
 }
 
 
 nsresult ProxyGetChildNamed(nsIMsgFolder *aFolder, const nsAString & aName,
                             nsIMsgFolder **aChild)
 {
-  nsRefPtr<GetChildNamedRunnable> getChildNamed =
+  RefPtr<GetChildNamedRunnable> getChildNamed =
     new GetChildNamedRunnable(aFolder, aName, aChild);
   return NS_DispatchToMainThread(getChildNamed, NS_DISPATCH_SYNC);
 }
 
 class GetParentRunnable : public nsRunnable
 {
 public:
   GetParentRunnable(nsIMsgFolder *aFolder, nsIMsgFolder **aParent);
@@ -1067,17 +1067,17 @@ GetParentRunnable::GetParentRunnable(nsI
 NS_IMETHODIMP GetParentRunnable::Run()
 {
   return m_folder->GetParent(m_parent);
 }
 
 
 nsresult ProxyGetParent(nsIMsgFolder *aFolder, nsIMsgFolder **aParent)
 {
-  nsRefPtr<GetParentRunnable> getParent =
+  RefPtr<GetParentRunnable> getParent =
     new GetParentRunnable(aFolder, aParent);
   return NS_DispatchToMainThread(getParent, NS_DISPATCH_SYNC);
 }
 
 class ContainsChildNamedRunnable : public nsRunnable
 {
 public:
   ContainsChildNamedRunnable(nsIMsgFolder *aFolder, const nsAString& aName, bool *aResult);
@@ -1099,17 +1099,17 @@ NS_IMETHODIMP ContainsChildNamedRunnable
 {
   return m_folder->ContainsChildNamed(m_name, m_result);
 }
 
 
 nsresult ProxyContainsChildNamed(nsIMsgFolder *aFolder, const nsAString &aName,
                                  bool *aResult)
 {
-  nsRefPtr<ContainsChildNamedRunnable> containsChildNamed =
+  RefPtr<ContainsChildNamedRunnable> containsChildNamed =
     new ContainsChildNamedRunnable(aFolder, aName, aResult);
   return NS_DispatchToMainThread(containsChildNamed, NS_DISPATCH_SYNC);
 }
 
 
 class GenerateUniqueSubfolderNameRunnable : public nsRunnable
 {
 public:
@@ -1139,17 +1139,17 @@ NS_IMETHODIMP GenerateUniqueSubfolderNam
 
 
 nsresult ProxyGenerateUniqueSubfolderName(nsIMsgFolder *aFolder,
                                           const nsAString& aPrefix,
                                           nsIMsgFolder *aOtherFolder,
                                           nsAString& aName)
 
 {
-  nsRefPtr<GenerateUniqueSubfolderNameRunnable> generateUniqueSubfolderName =
+  RefPtr<GenerateUniqueSubfolderNameRunnable> generateUniqueSubfolderName =
     new GenerateUniqueSubfolderNameRunnable(aFolder, aPrefix, aOtherFolder, aName);
   return NS_DispatchToMainThread(generateUniqueSubfolderName, NS_DISPATCH_SYNC);
 }
 
 class CreateSubfolderRunnable : public nsRunnable
 {
 public:
   CreateSubfolderRunnable(nsIMsgFolder *aFolder, const nsAString& aName);
@@ -1168,17 +1168,17 @@ CreateSubfolderRunnable::CreateSubfolder
 NS_IMETHODIMP CreateSubfolderRunnable::Run()
 {
   return m_folder->CreateSubfolder(m_name, nullptr);
 }
 
 
 nsresult ProxyCreateSubfolder(nsIMsgFolder *aFolder, const nsAString &aName)
 {
-  nsRefPtr<CreateSubfolderRunnable> createSubfolder =
+  RefPtr<CreateSubfolderRunnable> createSubfolder =
     new CreateSubfolderRunnable(aFolder, aName);
   return NS_DispatchToMainThread(createSubfolder, NS_DISPATCH_SYNC);
 }
 
 class ForceDBClosedRunnable : public nsRunnable
 {
 public:
   ForceDBClosedRunnable(nsIMsgFolder *aFolder);
@@ -1194,14 +1194,14 @@ ForceDBClosedRunnable::ForceDBClosedRunn
 
 NS_IMETHODIMP ForceDBClosedRunnable::Run()
 {
   return m_folder->ForceDBClosed();
 }
 
 nsresult ProxyForceDBClosed(nsIMsgFolder *aFolder)
 {
-  nsRefPtr<ForceDBClosedRunnable> forceDBClosed =
+  RefPtr<ForceDBClosedRunnable> forceDBClosed =
     new ForceDBClosedRunnable(aFolder);
   return NS_DispatchToMainThread(forceDBClosed, NS_DISPATCH_SYNC);
 }
 
 
--- a/mailnews/import/src/nsImportService.cpp
+++ b/mailnews/import/src/nsImportService.cpp
@@ -357,17 +357,17 @@ nsImportService::CreateRFC822Message(nsI
                                      nsIMsgCompFields *aMsgFields,
                                      const char *aBodyType,
                                      const nsACString &aBody,
                                      bool aIsDraft,
                                      nsIArray *aLoadedAttachments,
                                      nsIArray *aEmbeddedAttachments,
                                      nsIMsgSendListener *aListener)
 {
-    nsRefPtr<nsProxySendRunnable> runnable =
+    RefPtr<nsProxySendRunnable> runnable =
       new nsProxySendRunnable(aIdentity,
                               aMsgFields,
                               aBodyType,
                               aBody,
                               aIsDraft,
                               aLoadedAttachments,
                               aEmbeddedAttachments,
                               aListener);
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -1641,17 +1641,17 @@ nsMsgLocalMailFolder::CopyMessages(nsIMs
       if (msgDb)
         parseMsgState->SetMailDB(msgDb);
     }
   }
 
   // undo stuff
   if (allowUndo)    //no undo for folder move/copy or or move/copy from search window
   {
-    nsRefPtr<nsLocalMoveCopyMsgTxn> msgTxn = new nsLocalMoveCopyMsgTxn;
+    RefPtr<nsLocalMoveCopyMsgTxn> msgTxn = new nsLocalMoveCopyMsgTxn;
     if (msgTxn && NS_SUCCEEDED(msgTxn->Init(srcFolder, this, isMove)))
     {
       msgTxn->SetMsgWindow(msgWindow);
       if (isMove)
       {
         if (mFlags & nsMsgFolderFlags::Trash)
           msgTxn->SetTransactionType(nsIMessenger::eDeleteMsg);
         else
@@ -2336,17 +2336,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndC
       // enable the dest folder
       EnableNotifications(allMessageCountNotifications, true, false /*dbBatching*/); //dest folder doesn't need db batching
     }
     return NS_OK;
   }
 
   bool multipleCopiesFinished = (mCopyState->m_curCopyIndex >= mCopyState->m_totalMsgCount);
 
-  nsRefPtr<nsLocalMoveCopyMsgTxn> localUndoTxn = mCopyState->m_undoMsgTxn;
+  RefPtr<nsLocalMoveCopyMsgTxn> localUndoTxn = mCopyState->m_undoMsgTxn;
 
   NS_ASSERTION(mCopyState->m_leftOver == 0, "whoops, something wrong with previous copy");
   mCopyState->m_leftOver = 0; // reset to 0.
   // need to reset this in case we're move/copying multiple msgs.
   mCopyState->m_fromLineSeen = false;
 
   // flush the copied message. We need a close at the end to get the
   // file size and time updated correctly.
@@ -2669,17 +2669,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Star
   return WriteStartOfNewMessage();
 }
 
 // just finished the current message.
 NS_IMETHODIMP nsMsgLocalMailFolder::EndMessage(nsMsgKey key)
 {
   NS_ENSURE_ARG_POINTER(mCopyState);
 
-  nsRefPtr<nsLocalMoveCopyMsgTxn> localUndoTxn = mCopyState->m_undoMsgTxn;
+  RefPtr<nsLocalMoveCopyMsgTxn> localUndoTxn = mCopyState->m_undoMsgTxn;
   nsCOMPtr<nsIMsgWindow> msgWindow;
   nsresult rv;
 
   if (localUndoTxn)
   {
     localUndoTxn->GetMsgWindow(getter_AddRefs(msgWindow));
     localUndoTxn->AddSrcKey(key);
     localUndoTxn->AddDstKey(mCopyState->m_curDstKey);
@@ -3679,17 +3679,17 @@ nsMsgLocalMailFolder::AddMessageBatch(ui
 
   if (NS_SUCCEEDED(rv))
   {
     nsCOMPtr<nsIMutableArray> hdrArray =
       do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     for (uint32_t i = 0; i < aMessageCount; i++)
     {
-      nsRefPtr<nsParseNewMailState> newMailParser = new nsParseNewMailState;
+      RefPtr<nsParseNewMailState> newMailParser = new nsParseNewMailState;
       NS_ENSURE_TRUE(newMailParser, NS_ERROR_OUT_OF_MEMORY);
       if (!mGettingNewMessages)
         newMailParser->DisableFilters();
       bool reusable;
       rv = msgStore->GetNewMsgOutputStream(this, getter_AddRefs(newHdr),
                                       &reusable,
                                       getter_AddRefs(outFileStream));
       NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/local/src/nsLocalMailFolder.h
+++ b/mailnews/local/src/nsLocalMailFolder.h
@@ -36,20 +36,20 @@ struct nsLocalMailCopyState
   
   nsCOMPtr <nsIOutputStream> m_fileStream;
   nsCOMPtr<nsIMsgPluggableStore> m_msgStore;
   nsCOMPtr<nsISupports> m_srcSupport;
   /// Source nsIMsgDBHdr instances.
   nsCOMPtr<nsIArray> m_messages;
   /// Destination nsIMsgDBHdr instances.
   nsCOMPtr<nsIMutableArray> m_destMessages;
-  nsRefPtr<nsLocalMoveCopyMsgTxn> m_undoMsgTxn;
+  RefPtr<nsLocalMoveCopyMsgTxn> m_undoMsgTxn;
   nsCOMPtr<nsIMsgDBHdr> m_message; // current copy message
   nsMsgMessageFlagType m_flags; // current copy message flags
-  nsRefPtr<nsParseMailMessageState> m_parseMsgState;
+  RefPtr<nsParseMailMessageState> m_parseMsgState;
   nsCOMPtr<nsIMsgCopyServiceListener> m_listener;
   nsCOMPtr<nsIMsgWindow> m_msgWindow;
   nsCOMPtr<nsIMsgDatabase> m_destDB;
 
   // for displaying status;
   nsCOMPtr <nsIMsgStatusFeedback> m_statusFeedback;
   nsCOMPtr <nsIStringBundle> m_stringBundle;
   int64_t m_lastProgressTime;
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -21,17 +21,17 @@
 #include "nsIPop3Service.h"
 #include "nsMsgUtils.h"
 #include "nsNetUtil.h"
 #include "nsIDocShellLoadInfo.h"
 #include "nsIWebNavigation.h"
 #include "prprf.h"
 #include "nsIMsgHdr.h"
 #include "nsIFileURL.h"
-#include "mozilla/nsRefPtr.h"
+#include "mozilla/RefPtr.h"
 
 nsMailboxService::nsMailboxService()
 {
     mPrintingOperation = false;
 }
 
 nsMailboxService::~nsMailboxService()
 {}
@@ -595,17 +595,17 @@ NS_IMETHODIMP nsMailboxService::NewChann
       nsCOMPtr <nsIURI> pop3Uri;
 
       rv = handler->NewURI(spec, "" /* ignored */, aURI, getter_AddRefs(pop3Uri));
       NS_ENSURE_SUCCESS(rv, rv);
       return handler->NewChannel2(pop3Uri, aLoadInfo, _retval);
     }
   }
 
-  nsRefPtr<nsMailboxProtocol> protocol = new nsMailboxProtocol(aURI);
+  RefPtr<nsMailboxProtocol> protocol = new nsMailboxProtocol(aURI);
   if (!protocol) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   rv = protocol->Initialize(aURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = protocol->SetLoadInfo(aLoadInfo);
--- a/mailnews/local/src/nsMovemailService.cpp
+++ b/mailnews/local/src/nsMovemailService.cpp
@@ -80,17 +80,17 @@ public:
   ~SpoolLock();
 
   bool isLocked();
 
 private:
   bool mLocked;
   nsCString mSpoolName;
   bool mUsingLockFile;
-  nsRefPtr<nsMovemailService> mOwningService;
+  RefPtr<nsMovemailService> mOwningService;
   nsCOMPtr<nsIMsgIncomingServer> mServer;
 
   bool ObtainSpoolLock(unsigned int aSeconds);
   bool YieldSpoolLock();
 };
 
 }
 
@@ -463,17 +463,17 @@ nsMovemailService::GetNewMail(nsIMsgWind
                                         getter_AddRefs(inbox));
   NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && inbox, rv);
 
   nsCOMPtr<nsIMsgPluggableStore> msgStore;
   rv = in_server->GetMsgStore(getter_AddRefs(msgStore));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // create a new mail parser
-  nsRefPtr<nsParseNewMailState> newMailParser = new nsParseNewMailState;
+  RefPtr<nsParseNewMailState> newMailParser = new nsParseNewMailState;
 
   // Try and obtain the lock for the spool file.
   SpoolLock lock(&spoolPath, 5, *this, in_server);
   if (!lock.isLocked())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIMsgDBHdr> newHdr;
   nsCOMPtr<nsIOutputStream> outputStream;
--- a/mailnews/local/src/nsMsgBrkMBoxStore.cpp
+++ b/mailnews/local/src/nsMsgBrkMBoxStore.cpp
@@ -811,17 +811,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::Rebuild
     NS_ASSERTION(false, "Could not get folder lock");
     return NS_MSG_FOLDER_BUSY;
   }
 
   nsCOMPtr<nsIMailboxService> mailboxService =
     do_GetService(NS_MAILBOXSERVICE_CONTRACTID1, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsRefPtr<nsMsgMailboxParser> parser = new nsMsgMailboxParser(aFolder);
+  RefPtr<nsMsgMailboxParser> parser = new nsMsgMailboxParser(aFolder);
   NS_ENSURE_TRUE(parser, NS_ERROR_OUT_OF_MEMORY);
   rv = parser->Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return mailboxService->ParseMailbox(aMsgWindow, pathFile, parser, aListener,
                                       nullptr);
 }
 
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -1007,17 +1007,17 @@ nsMsgMaildirStore::CopyMessages(bool aIs
 
   nsCOMPtr<nsIFile> srcFolderPath;
   rv = srcFolder->GetFilePath(getter_AddRefs(srcFolderPath));
   NS_ENSURE_SUCCESS(rv, rv);
   srcFolderPath->Append(NS_LITERAL_STRING("cur"));
 
   nsCOMPtr<nsIMsgDatabase> srcDB;
   srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
-  nsRefPtr<nsLocalMoveCopyMsgTxn> msgTxn = new nsLocalMoveCopyMsgTxn;
+  RefPtr<nsLocalMoveCopyMsgTxn> msgTxn = new nsLocalMoveCopyMsgTxn;
   NS_ENSURE_TRUE(msgTxn, NS_ERROR_OUT_OF_MEMORY);
   if (NS_SUCCEEDED(msgTxn->Init(srcFolder, aDstFolder, aIsMove)))
   {
     if (aIsMove)
       msgTxn->SetTransactionType(nsIMessenger::eMoveMsg);
     else
       msgTxn->SetTransactionType(nsIMessenger::eCopyMsg);
   }
--- a/mailnews/local/src/nsParseMailbox.h
+++ b/mailnews/local/src/nsParseMailbox.h
@@ -238,17 +238,17 @@ protected:
   nsCOMPtr <nsIMsgFilterList> m_filterList;
   nsCOMPtr <nsIMsgFilterList> m_deferredToServerFilterList;
   nsCOMPtr <nsIMsgFolder> m_rootFolder;
   nsCOMPtr <nsIMsgWindow> m_msgWindow;
   nsCOMPtr <nsIMsgFolder> m_downloadFolder;
   nsCOMPtr<nsIOutputStream> m_outputStream;
   nsCOMArray <nsIMsgFolder> m_filterTargetFolders;
 
-  nsRefPtr<nsImapMoveCoalescer> m_moveCoalescer;
+  RefPtr<nsImapMoveCoalescer> m_moveCoalescer;
 
   bool          m_msgMovedByFilter;
   bool          m_msgCopiedByFilter;
   bool          m_disableFilters;
   uint32_t      m_ibuffer_fp;
   char          *m_ibuffer;
   uint32_t      m_ibuffer_size;
   // used for applying move filters, because in the case of using a temporary
--- a/mailnews/local/src/nsPop3IncomingServer.cpp
+++ b/mailnews/local/src/nsPop3IncomingServer.cpp
@@ -160,17 +160,17 @@ NS_IMETHODIMP nsPop3IncomingServer::GetD
               if (subFolder)
               {
                 nsCOMPtr<nsIMsgDatabase> subFolderDB;
                 subFolder->GetMsgDatabase(getter_AddRefs(subFolderDB));
                 if (subFolderDB)
                 {
                   // Copy any messages in this sub-folder of the hidden
                   // account to the corresponding folder in Local Folders.
-                  nsRefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
+                  RefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
                   rv = subFolderDB->ListAllKeys(keys);
                   nsCOMPtr<nsIMutableArray> hdrsToCopy(do_CreateInstance(NS_ARRAY_CONTRACTID));
                   MsgGetHeadersFromKeys(subFolderDB, keys->m_keys, hdrsToCopy);
                   uint32_t numHdrs = 0;
                   if (hdrsToCopy)
                     hdrsToCopy->GetLength(&numHdrs);
                   if (numHdrs)
                   {
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -250,17 +250,17 @@ nsresult nsPop3Service::RunPopUrl(nsIMsg
 
   // find out if the server is busy or not...if the server is busy, we are
   // *NOT* going to run the url
   bool serverBusy = false;
   rv = aServer->GetServerBusy(&serverBusy);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!serverBusy)
   {
-    nsRefPtr<nsPop3Protocol> protocol = new nsPop3Protocol(aUrlToRun);
+    RefPtr<nsPop3Protocol> protocol = new nsPop3Protocol(aUrlToRun);
     if (protocol)
     {
       // the protocol stores the unescaped username, so there is no need to escape it.
       protocol->SetUsername(userName.get());
       rv = protocol->LoadUrl(aUrlToRun);
       if (NS_FAILED(rv))
         aServer->SetServerBusy(false);
     }
@@ -504,17 +504,17 @@ NS_IMETHODIMP nsPop3Service::NewChannel2
       {
         AlertServerBusy(url);
         return NS_MSG_FOLDER_BUSY;
       }
       server->GetRealUsername(realUserName);
     }
   }
 
-  nsRefPtr<nsPop3Protocol> protocol = new nsPop3Protocol(aURI);
+  RefPtr<nsPop3Protocol> protocol = new nsPop3Protocol(aURI);
   NS_ENSURE_TRUE(protocol, NS_ERROR_OUT_OF_MEMORY);
 
   rv = protocol->Initialize(aURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = protocol->SetLoadInfo(aLoadInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/mailnews/local/src/nsPop3Sink.h
+++ b/mailnews/local/src/nsPop3Sink.h
@@ -55,17 +55,17 @@ protected:
     int32_t m_numNewMessages;
     int32_t m_numNewMessagesInFolder;
     int32_t m_numMsgsDownloaded;
     bool m_senderAuthed;
     nsCString m_outputBuffer;
     nsCOMPtr<nsIPop3IncomingServer> m_popServer;
     //Currently the folder we want to update about biff info
     nsCOMPtr<nsIMsgFolder> m_folder;
-    nsRefPtr<nsParseNewMailState> m_newMailParser;
+    RefPtr<nsParseNewMailState> m_newMailParser;
     nsCOMPtr <nsIOutputStream> m_outFileStream; // the file we write to, which may be temporary
     nsCOMPtr<nsIMsgPluggableStore> m_msgStore;
     bool m_uidlDownload;
     bool m_buildMessageUri;
     bool m_downloadingToTempFile;
     nsCOMPtr <nsIFile> m_tmpDownloadFile;
     nsCOMPtr<nsIMsgWindow> m_window;
     nsCString m_messageUri;
--- a/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
@@ -157,19 +157,19 @@ nsMimeHtmlDisplayEmitter::GetHeaderSink(
   *aHeaderSink = mHeaderSink;
   NS_IF_ADDREF(*aHeaderSink);
   return rv;
 }
 
 nsresult nsMimeHtmlDisplayEmitter::BroadcastHeaders(nsIMsgHeaderSink * aHeaderSink, int32_t aHeaderMode, bool aFromNewsgroup)
 {
   // two string enumerators to pass out to the header sink
-  nsRefPtr<nsMimeStringEnumerator> headerNameEnumerator = new nsMimeStringEnumerator();
+  RefPtr<nsMimeStringEnumerator> headerNameEnumerator = new nsMimeStringEnumerator();
   NS_ENSURE_TRUE(headerNameEnumerator, NS_ERROR_OUT_OF_MEMORY);
-  nsRefPtr<nsMimeStringEnumerator> headerValueEnumerator = new nsMimeStringEnumerator();
+  RefPtr<nsMimeStringEnumerator> headerValueEnumerator = new nsMimeStringEnumerator();
   NS_ENSURE_TRUE(headerValueEnumerator, NS_ERROR_OUT_OF_MEMORY);
 
   nsCString extraExpandedHeaders;
   nsTArray<nsCString> extraExpandedHeadersArray;
   nsAutoCString convertedDateString;
 
   nsresult rv;
   nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
--- a/mailnews/mime/src/mimecms.cpp
+++ b/mailnews/mime/src/mimecms.cpp
@@ -269,17 +269,17 @@ NS_IMETHODIMP SignedStatusRunnable::Run(
 }
 
 
 nsresult ProxySignedStatus(const nsMainThreadPtrHandle<nsIMsgSMIMEHeaderSink> &aSink,
                            int32_t aNestingLevel,
                            int32_t aSignatureStatus,
                            nsIX509Cert *aSignerCert)
 {
-  nsRefPtr<SignedStatusRunnable> signedStatus =
+  RefPtr<SignedStatusRunnable> signedStatus =
     new SignedStatusRunnable(aSink, aNestingLevel, aSignatureStatus, aSignerCert);
   return NS_DispatchToMainThread(signedStatus, NS_DISPATCH_SYNC);
 }
 
 NS_IMPL_ISUPPORTS(nsSMimeVerificationListener, nsISMimeVerificationListener)
 
 nsSMimeVerificationListener::nsSMimeVerificationListener(const char *aFromAddr, const char *aFromName,
                                                          const char *aSenderAddr, const char *aSenderName,
@@ -568,17 +568,17 @@ void MimeCMSRequestAsyncSignatureVerific
                                               const char *aSenderAddr, const char *aSenderName,
                                               nsIMsgSMIMEHeaderSink *aHeaderSink, int32_t aMimeNestingLevel,
                                               unsigned char* item_data, uint32_t item_len)
 {
   nsCOMPtr<nsICMSMessage2> msg2 = do_QueryInterface(aCMSMsg);
   if (!msg2)
     return;
   
-  nsRefPtr<nsSMimeVerificationListener> listener = 
+  RefPtr<nsSMimeVerificationListener> listener = 
     new nsSMimeVerificationListener(aFromAddr, aFromName, aSenderAddr, aSenderName,
                                     aHeaderSink, aMimeNestingLevel);
   if (!listener)
     return;
   
   if (item_data)
     msg2->AsyncVerifyDetachedSignature(listener, item_data, item_len);
   else
--- a/mailnews/mime/src/nsSimpleMimeConverterStub.cpp
+++ b/mailnews/mime/src/nsSimpleMimeConverterStub.cpp
@@ -194,13 +194,13 @@ nsSimpleMimeConverterStub::CreateContent
     initStruct->force_inline_display = true;
     return NS_OK;;
 }
 
 nsresult
 MIME_NewSimpleMimeConverterStub(const char *aContentType,
                                 nsIMimeContentTypeHandler **aResult)
 {
-    nsRefPtr<nsSimpleMimeConverterStub> inst = new nsSimpleMimeConverterStub(aContentType);
+    RefPtr<nsSimpleMimeConverterStub> inst = new nsSimpleMimeConverterStub(aContentType);
     NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
 
     return CallQueryInterface(inst.get(), aResult);
 }
--- a/mailnews/news/src/nsNNTPArticleList.cpp
+++ b/mailnews/news/src/nsNNTPArticleList.cpp
@@ -40,17 +40,17 @@ nsNNTPArticleList::Initialize(nsIMsgNews
 
     nsCOMPtr <nsIMsgFolder> folder = do_QueryInterface(m_newsFolder, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
     rv = folder->GetMsgDatabase(getter_AddRefs(m_newsDB));
     NS_ENSURE_SUCCESS(rv,rv);
     if (!m_newsDB) return NS_ERROR_UNEXPECTED;
 
-    nsRefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
+    RefPtr<nsMsgKeyArray> keys = new nsMsgKeyArray;
     rv = m_newsDB->ListAllKeys(keys);
     NS_ENSURE_SUCCESS(rv,rv);
     keys->Sort();
     m_idsInDB.AppendElements(keys->m_keys);
 
     return NS_OK;
 }
 
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -615,17 +615,17 @@ nsNntpIncomingServer::PrepareForNextUrl(
 {
   NS_ENSURE_ARG(aConnection);
 
   // Start the connection on the next URL in the queue. If it can't get a URL to
   // work, drop that URL (the channel will handle failure notification) and move
   // on.
   while (m_queuedChannels.Length() > 0)
   {
-    nsRefPtr<nsNntpMockChannel> channel = m_queuedChannels[0];
+    RefPtr<nsNntpMockChannel> channel = m_queuedChannels[0];
     m_queuedChannels.RemoveElementAt(0);
     nsresult rv = channel->AttachNNTPConnection(*aConnection);
     // If this succeeded, the connection is now running the URL.
     if (NS_SUCCEEDED(rv))
       return NS_OK;
   }
   
   // No queued uris.
--- a/mailnews/news/src/nsNntpIncomingServer.h
+++ b/mailnews/news/src/nsNntpIncomingServer.h
@@ -78,17 +78,17 @@ protected:
    virtual nsresult CreateRootFolderFromUri(const nsCString &serverUri,
                                             nsIMsgFolder **rootFolder);
     nsresult GetNntpConnection(nsIURI *url, nsIMsgWindow *window,
                                nsINNTPProtocol **aNntpConnection);
     nsresult CreateProtocolInstance(nsINNTPProtocol **aNntpConnection,
                                     nsIURI *url, nsIMsgWindow *window);
     bool ConnectionTimeOut(nsINNTPProtocol* aNntpConnection);
     nsCOMArray<nsINNTPProtocol> mConnectionCache;
-    nsTArray<nsRefPtr<nsNntpMockChannel> > m_queuedChannels;
+    nsTArray<RefPtr<nsNntpMockChannel> > m_queuedChannels;
 
     /**
      * Downloads the newsgroup headers.
      */
     nsresult DownloadMail(nsIMsgWindow *aMsgWindow);
 
     NS_IMETHOD GetServerRequiresPasswordForBiff(bool *aServerRequiresPasswordForBiff);
     nsresult SetupNewsrcSaveTimer();