Bug 1503839 - Port bug 1503207: replace include of nsWeakPtr.h with nsIWeakReferenceUtils.h, use nsWeakPtr. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Thu, 01 Nov 2018 13:43:06 +0100
changeset 33637 de28835aa5f12a5ff3283fedf7f592577ea7a79e
parent 33636 4c2c4bf909f769f75c51339349a0b28497b015e4
child 33638 29028feb0c71338166c9d4fc24cbad6312334f4c
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersbustage-fix
bugs1503839, 1503207
Bug 1503839 - Port bug 1503207: replace include of nsWeakPtr.h with nsIWeakReferenceUtils.h, use nsWeakPtr. rs=bustage-fix
ldap/xpcom/src/nsLDAPConnection.h
mailnews/addrbook/src/nsAddrDatabase.h
mailnews/base/src/nsMessengerUnixIntegration.cpp
mailnews/base/src/nsMessengerWinIntegration.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgSendLater.h
mailnews/imap/src/nsAutoSyncState.h
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsImapUrl.h
mailnews/local/src/nsLocalUndoTxn.h
mailnews/local/src/nsParseMailbox.h
rdf/datasource/nsLocalStore.cpp
--- a/ldap/xpcom/src/nsLDAPConnection.h
+++ b/ldap/xpcom/src/nsLDAPConnection.h
@@ -12,17 +12,16 @@
 #include "nsString.h"
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 #include "nsCOMPtr.h"
 #include "nsILDAPMessageListener.h"
 #include "nsInterfaceHashtable.h"
 #include "nspr.h"
 #include "nsWeakReference.h"
-#include "nsWeakPtr.h"
 #include "nsIDNSListener.h"
 #include "nsICancelable.h"
 #include "nsIRequest.h"
 #include "nsCOMArray.h"
 #include "nsIObserver.h"
 #include "nsAutoPtr.h"
 #include "mozilla/Mutex.h"
 
--- a/mailnews/addrbook/src/nsAddrDatabase.h
+++ b/mailnews/addrbook/src/nsAddrDatabase.h
@@ -9,17 +9,17 @@
 #include "mozilla/Attributes.h"
 #include "nsIAddrDatabase.h"
 #include "nsIFile.h"
 #include "mdb.h"
 #include "nsString.h"
 #include "nsIAddrDBListener.h"
 #include "nsCOMPtr.h"
 #include "nsTObserverArray.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 typedef enum
 {
   AB_NotifyInserted,
   AB_NotifyDeleted,
   AB_NotifyPropertyChanged
 } AB_NOTIFY_CODE;
 
--- a/mailnews/base/src/nsMessengerUnixIntegration.cpp
+++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp
@@ -451,17 +451,17 @@ void nsMessengerUnixIntegration::FillToo
     return;
 
   nsCString folderUri;
   GetFirstFolderWithNewMail(folderUri);
 
   uint32_t count = 0;
   NS_ENSURE_SUCCESS_VOID(mFoldersWithNewMail->GetLength(&count));
 
-  nsCOMPtr<nsIWeakReference> weakReference;
+  nsWeakPtr weakReference;
   nsCOMPtr<nsIMsgFolder> folder = nullptr;
   nsCOMPtr<nsIMsgFolder> folderWithNewMail = nullptr;
 
   uint32_t i;
   for (i = 0; i < count && !folderWithNewMail; i++)
   {
     weakReference = do_QueryElementAt(mFoldersWithNewMail, i);
     folder = do_QueryReferent(weakReference);
@@ -558,17 +558,17 @@ void nsMessengerUnixIntegration::FillToo
 // Get the first top level folder which we know has new mail, then enumerate over
 // all the subfolders looking for the first real folder with new mail.
 // Return the folderURI for that folder.
 nsresult nsMessengerUnixIntegration::GetFirstFolderWithNewMail(nsACString& aFolderURI)
 {
   NS_ENSURE_TRUE(mFoldersWithNewMail, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIMsgFolder> folder;
-  nsCOMPtr<nsIWeakReference> weakReference;
+  nsWeakPtr weakReference;
 
   uint32_t count = 0;
   nsresult rv = mFoldersWithNewMail->GetLength(&count);
   if (NS_FAILED(rv) || !count)  // kick out if we don't have any folders with new mail
     return NS_OK;
 
   uint32_t i;
   for(i = 0; i < count; i++)
@@ -671,17 +671,17 @@ nsMessengerUnixIntegration::OnItemEvent(
 
 NS_IMETHODIMP
 nsMessengerUnixIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, const nsACString &aProperty, int64_t aOldValue, int64_t aNewValue)
 {
   nsCString atomName;
   // if we got new mail show an icon in the system tray
   if (aProperty.Equals(kBiffState) && mFoldersWithNewMail)
   {
-    nsCOMPtr<nsIWeakReference> weakFolder = do_GetWeakReference(aItem);
+    nsWeakPtr weakFolder = do_GetWeakReference(aItem);
     uint32_t indexInNewArray;
     nsresult rv = mFoldersWithNewMail->IndexOf(0, weakFolder, &indexInNewArray);
     bool folderFound = NS_SUCCEEDED(rv);
 
     if (aNewValue == nsIMsgFolder::nsMsgBiffState_NewMail)
     {
       // only show a system tray icon iff we are performing biff
       // (as opposed to the user getting new mail)
--- a/mailnews/base/src/nsMessengerWinIntegration.cpp
+++ b/mailnews/base/src/nsMessengerWinIntegration.cpp
@@ -644,17 +644,17 @@ void nsMessengerWinIntegration::FillTool
 {
   // iterate over all the folders in mFoldersWithNewMail
   nsString accountName;
   nsCString hostName;
   nsString toolTipLine;
   nsAutoString toolTipText;
   nsAutoString animatedAlertText;
   nsCOMPtr<nsIMsgFolder> folder;
-  nsCOMPtr<nsIWeakReference> weakReference;
+  nsWeakPtr weakReference;
   int32_t numNewMessages = 0;
 
   uint32_t count = 0;
   NS_ENSURE_SUCCESS_VOID(mFoldersWithNewMail->GetLength(&count));
 
   for (uint32_t index = 0; index < count; index++)
   {
     weakReference = do_QueryElementAt(mFoldersWithNewMail, index);
@@ -727,17 +727,17 @@ void nsMessengerWinIntegration::FillTool
 // Get the first top level folder which we know has new mail, then enumerate over
 // all the subfolders looking for the first real folder with new mail.
 // Return the folderURI for that folder.
 nsresult nsMessengerWinIntegration::GetFirstFolderWithNewMail(nsACString& aFolderURI)
 {
   NS_ENSURE_TRUE(mFoldersWithNewMail, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIMsgFolder> folder;
-  nsCOMPtr<nsIWeakReference> weakReference;
+  nsWeakPtr weakReference;
   int32_t numNewMessages = 0;
 
   uint32_t count = 0;
   nsresult rv = mFoldersWithNewMail->GetLength(&count);
   if (NS_FAILED(rv) || !count)  // kick out if we don't have any folders with new mail
     return NS_OK;
 
   weakReference = do_QueryElementAt(mFoldersWithNewMail, 0);
@@ -841,17 +841,17 @@ nsMessengerWinIntegration::OnItemEvent(n
 }
 
 NS_IMETHODIMP
 nsMessengerWinIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, const nsACString &aProperty, int64_t aOldValue, int64_t aNewValue)
 {
   // if we got new mail show a icon in the system tray
   if (aProperty.Equals(kBiffState) && mFoldersWithNewMail)
   {
-    nsCOMPtr<nsIWeakReference> weakFolder = do_GetWeakReference(aItem);
+    nsWeakPtr weakFolder = do_GetWeakReference(aItem);
     uint32_t indexInNewArray;
     nsresult rv = mFoldersWithNewMail->IndexOf(0, weakFolder, &indexInNewArray);
     bool folderFound = NS_SUCCEEDED(rv);
 
     if (!mBiffIconInitialized)
       InitializeBiffStatusIcon();
 
     if (aNewValue == nsIMsgFolder::nsMsgBiffState_NewMail)
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -1092,17 +1092,17 @@ public:
         NS_ASSERTION(NS_SUCCEEDED(rv) || rv == NS_BINDING_ABORTED, "unexpected error writing stream");
         return NS_OK;
     }
 
 
 protected:
   virtual ~nsMsgProtocolStreamProvider() {}
 
-  nsCOMPtr<nsIWeakReference> mMsgProtocol;
+  nsWeakPtr mMsgProtocol;
   nsCOMPtr<nsIInputStream>  mInStream;
 };
 
 NS_IMPL_ISUPPORTS(nsMsgProtocolStreamProvider,
                               nsIOutputStreamCallback)
 
 class nsMsgFilePostHelper : public nsIStreamListener
 {
@@ -1114,17 +1114,17 @@ public:
   nsMsgFilePostHelper() { mSuspendedPostFileRead = false;}
   nsresult Init(nsIOutputStream * aOutStream, nsMsgAsyncWriteProtocol * aProtInstance, nsIFile *aFileToPost);
   nsCOMPtr<nsIRequest> mPostFileRequest;
   bool mSuspendedPostFileRead;
   void CloseSocket() { mProtInstance = nullptr; }
 protected:
   virtual ~nsMsgFilePostHelper() {}
   nsCOMPtr<nsIOutputStream> mOutStream;
-  nsCOMPtr<nsIWeakReference> mProtInstance;
+  nsWeakPtr mProtInstance;
 };
 
 NS_IMPL_ISUPPORTS(nsMsgFilePostHelper, nsIStreamListener, nsIRequestObserver)
 
 nsresult nsMsgFilePostHelper::Init(nsIOutputStream * aOutStream, nsMsgAsyncWriteProtocol * aProtInstance, nsIFile *aFileToPost)
 {
   nsresult rv = NS_OK;
   mOutStream = aOutStream;
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1180,32 +1180,32 @@ nsMsgComposeService::RegisterComposeDocS
                                              nsIMsgCompose *aComposeObject)
 {
   NS_ENSURE_ARG_POINTER(aDocShell);
   NS_ENSURE_ARG_POINTER(aComposeObject);
 
   nsresult rv;
 
   // add the msg compose / dom window mapping to our hash table
-  nsCOMPtr<nsIWeakReference> weakDocShell = do_GetWeakReference(aDocShell, &rv);
+  nsWeakPtr weakDocShell = do_GetWeakReference(aDocShell, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
-  nsCOMPtr<nsIWeakReference> weakMsgComposePtr = do_GetWeakReference(aComposeObject);
+  nsWeakPtr weakMsgComposePtr = do_GetWeakReference(aComposeObject);
   NS_ENSURE_SUCCESS(rv,rv);
   mOpenComposeWindows.Put(weakDocShell, weakMsgComposePtr);
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgComposeService::UnregisterComposeDocShell(nsIDocShell *aDocShell)
 {
   NS_ENSURE_ARG_POINTER(aDocShell);
 
   nsresult rv;
-  nsCOMPtr<nsIWeakReference> weakDocShell = do_GetWeakReference(aDocShell, &rv);
+  nsWeakPtr weakDocShell = do_GetWeakReference(aDocShell, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   mOpenComposeWindows.Remove(weakDocShell);
 
   return rv;
 }
 
 NS_IMETHODIMP
@@ -1215,20 +1215,20 @@ nsMsgComposeService::GetMsgComposeForDoc
   NS_ENSURE_ARG_POINTER(aDocShell);
   NS_ENSURE_ARG_POINTER(aComposeObject);
 
   if (!mOpenComposeWindows.Count())
     return NS_ERROR_FAILURE;
 
   // get the weak reference for our dom window
   nsresult rv;
-  nsCOMPtr<nsIWeakReference> weakDocShell = do_GetWeakReference(aDocShell, &rv);
+  nsWeakPtr weakDocShell = do_GetWeakReference(aDocShell, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsIWeakReference> weakMsgComposePtr;
+  nsWeakPtr weakMsgComposePtr;
 
   if (!mOpenComposeWindows.Get(weakDocShell,
                                getter_AddRefs(weakMsgComposePtr)))
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIMsgCompose> msgCompose = do_QueryReferent(weakMsgComposePtr, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/mailnews/compose/src/nsMsgSendLater.h
+++ b/mailnews/compose/src/nsMsgSendLater.h
@@ -12,17 +12,17 @@
 #include "nsIMsgSendLaterListener.h"
 #include "nsIMsgSendLater.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsTObserverArray.h"
 #include "nsIObserver.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsIMsgShutdown.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 ////////////////////////////////////////////////////////////////////////////////////
 // This is the listener class for the send operation. We have to create this class
 // to listen for message send completion and eventually notify the caller
 ////////////////////////////////////////////////////////////////////////////////////
 class nsMsgSendLater;
 
 class SendOperationListener : public nsIMsgSendListener,
--- a/mailnews/imap/src/nsAutoSyncState.h
+++ b/mailnews/imap/src/nsAutoSyncState.h
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsAutoSyncState_h__
 #define nsAutoSyncState_h__
 
 #include "MailNewsTypes.h"
 #include "nsIAutoSyncState.h"
 #include "nsIUrlListener.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsTArray.h"
 #include "prlog.h"
 
 class nsImapMailFolder;
 class nsIAutoSyncMsgStrategy;
 class nsIMsgDatabase;
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -23,17 +23,17 @@
 // UI Thread proxy helper
 #include "nsIImapProtocolSink.h"
 
 #include "nsIIMAPHostSessionList.h"
 #include "nsImapServerResponseParser.h"
 #include "nsImapFlagAndUidState.h"
 #include "nsIMAPNamespace.h"
 #include "nsTArray.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsMsgLineBuffer.h" // we need this to use the nsMsgLineStreamBuffer helper class...
 #include "nsIInputStream.h"
 #include "nsIMsgIncomingServer.h"
 #include "nsCOMArray.h"
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 #include "nsIImapMockChannel.h"
 #include "nsILoadGroup.h"
--- a/mailnews/imap/src/nsImapUrl.h
+++ b/mailnews/imap/src/nsImapUrl.h
@@ -5,17 +5,17 @@
 
 #ifndef nsImapUrl_h___
 #define nsImapUrl_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIImapUrl.h"
 #include "nsCOMPtr.h"
 #include "nsMsgMailNewsUrl.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIFile.h"
 #include "mozilla/Mutex.h"
 
 class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
 {
 public:
 
   NS_DECL_ISUPPORTS_INHERITED
--- a/mailnews/local/src/nsLocalUndoTxn.h
+++ b/mailnews/local/src/nsLocalUndoTxn.h
@@ -10,17 +10,17 @@
 #include "msgCore.h"
 #include "nsIMsgFolder.h"
 #include "nsMailboxService.h"
 #include "nsMsgTxn.h"
 #include "MailNewsTypes.h"
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
 #include "nsIFolderListener.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 class nsLocalUndoFolderListener;
 
 class nsLocalMoveCopyMsgTxn : public nsIFolderListener, public nsMsgTxn
 {
 public:
     nsLocalMoveCopyMsgTxn();
     NS_DECL_ISUPPORTS_INHERITED
--- a/mailnews/local/src/nsParseMailbox.h
+++ b/mailnews/local/src/nsParseMailbox.h
@@ -12,17 +12,17 @@
 #include "nsIStreamListener.h"
 #include "nsMsgLineBuffer.h"
 #include "nsIMsgDatabase.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsIDBChangeListener.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIMsgWindow.h"
 #include "nsImapMoveCoalescer.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsIMsgFilterList.h"
 #include "nsIMsgFilter.h"
 #include "nsIMsgFilterHitNotify.h"
 #include "nsTArray.h"
--- a/rdf/datasource/nsLocalStore.cpp
+++ b/rdf/datasource/nsLocalStore.cpp
@@ -21,17 +21,16 @@
 #include "nsIRDFRemoteDataSource.h"
 #include "nsIRDFService.h"
 #include "nsIServiceManager.h"
 #include "nsRDFCID.h"
 #include "nsString.h"
 #include "plstr.h"
 #include "rdf.h"
 #include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsWeakReference.h"
 #include "nsCRTGlue.h"
 #include "nsCRT.h"
 #include "nsEnumeratorUtils.h"
 #include "nsCycleCollectionParticipant.h"