Bug 1498949 - Port bug 1494745: ns[Auto]TObserverArray methods that insert/append now return void. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Mon, 15 Oct 2018 01:32:32 +0200
changeset 33370 c12b2ee90c46b9ec5ee6807f81221e60009bb272
parent 33369 70bb0f355a9667d7d2e21cfc851ce6d7ba0c02fb
child 33371 aaeeda026e117a1ab009699dbfba52ba4ea9c52a
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersbustage-fix
bugs1498949, 1494745
Bug 1498949 - Port bug 1494745: ns[Auto]TObserverArray methods that insert/append now return void. rs=bustage-fix
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/compose/src/nsMsgCompose.cpp
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -148,17 +148,18 @@ nsAddrDatabase::~nsAddrDatabase()
   NS_IF_RELEASE(m_mdbEnv);
 }
 
 NS_IMPL_ISUPPORTS(nsAddrDatabase, nsIAddrDatabase, nsIAddrDBAnnouncer)
 
 NS_IMETHODIMP nsAddrDatabase::AddListener(nsIAddrDBListener *listener)
 {
   NS_ENSURE_ARG_POINTER(listener);
-  return m_ChangeListeners.AppendElement(listener) ? NS_OK : NS_ERROR_FAILURE;
+  m_ChangeListeners.AppendElement(listener);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::RemoveListener(nsIAddrDBListener *listener)
 {
   NS_ENSURE_ARG_POINTER(listener);
   return m_ChangeListeners.RemoveElement(listener) ? NS_OK : NS_ERROR_FAILURE;
 }
 
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -3043,21 +3043,24 @@ nsMsgDBFolder::GetNumSubFolders(uint32_t
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = mSubFolders.Count();
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::AddFolderListener(nsIFolderListener * listener)
 {
-  return mListeners.AppendElement(listener) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  NS_ENSURE_ARG_POINTER(listener);
+  mListeners.AppendElement(listener);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::RemoveFolderListener(nsIFolderListener * listener)
 {
+  NS_ENSURE_ARG_POINTER(listener);
   mListeners.RemoveElement(listener);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::SetParent(nsIMsgFolder *aParent)
 {
   mParent = do_GetWeakReference(aParent);
   if (aParent)
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1120,32 +1120,33 @@ nsresult nsMsgCompose::SetDocumentCharse
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgCompose::RegisterStateListener(nsIMsgComposeStateListener *aStateListener)
 {
   NS_ENSURE_ARG_POINTER(aStateListener);
 
-  return mStateListeners.AppendElement(aStateListener) ? NS_OK : NS_ERROR_FAILURE;
+  mStateListeners.AppendElement(aStateListener);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgCompose::UnregisterStateListener(nsIMsgComposeStateListener *aStateListener)
 {
   NS_ENSURE_ARG_POINTER(aStateListener);
-
   return mStateListeners.RemoveElement(aStateListener) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 // Added to allow easier use of the nsIMsgSendListener
 NS_IMETHODIMP nsMsgCompose::AddMsgSendListener( nsIMsgSendListener *aMsgSendListener )
 {
   NS_ENSURE_ARG_POINTER(aMsgSendListener);
-  return mExternalSendListeners.AppendElement(aMsgSendListener) ? NS_OK : NS_ERROR_FAILURE;
+  mExternalSendListeners.AppendElement(aMsgSendListener);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgCompose::RemoveMsgSendListener( nsIMsgSendListener *aMsgSendListener )
 {
   NS_ENSURE_ARG_POINTER(aMsgSendListener);
   return mExternalSendListeners.RemoveElement(aMsgSendListener) ? NS_OK : NS_ERROR_FAILURE;
 }