Bug 1494745 part 1 - Don't check the result from ns[Auto]TObserverArray::AppendElement since it's infallible. r=bz
authorMats Palmgren <mats@mozilla.com>
Sun, 14 Oct 2018 18:12:22 +0200
changeset 496908 4ac8ee3c801972a1c47e8270dccc801612c3aa21
parent 496888 d49587f5ccd37180d1f0d980c9dd076e7afa1bcb
child 496909 e0debd3f26f6d4ff98c8ede64aa05111864c56d0
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1494745
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1494745 part 1 - Don't check the result from ns[Auto]TObserverArray::AppendElement since it's infallible. r=bz mChildList and mListenerInfoList are ns[Auto]TObserverArray which are infallible, so no need to check the return value from AppendElement (which a later patch in this series will remove).
uriloader/base/nsDocLoader.cpp
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -638,21 +638,18 @@ nsresult nsDocLoader::RemoveChildLoader(
   if (NS_SUCCEEDED(rv)) {
     rv = aChild->SetDocLoaderParent(nullptr);
   }
   return rv;
 }
 
 nsresult nsDocLoader::AddChildLoader(nsDocLoader* aChild)
 {
-  nsresult rv = mChildList.AppendElement(aChild) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-  if (NS_SUCCEEDED(rv)) {
-    rv = aChild->SetDocLoaderParent(this);
-  }
-  return rv;
+  mChildList.AppendElement(aChild);
+  return aChild->SetDocLoaderParent(this);
 }
 
 NS_IMETHODIMP nsDocLoader::GetDocumentChannel(nsIChannel ** aChannel)
 {
   if (!mDocumentRequest) {
     *aChannel = nullptr;
     return NS_OK;
   }
@@ -878,18 +875,18 @@ nsDocLoader::AddProgressListener(nsIWebP
     return NS_ERROR_FAILURE;
   }
 
   nsWeakPtr listener = do_GetWeakReference(aListener);
   if (!listener) {
     return NS_ERROR_INVALID_ARG;
   }
 
-  return mListenerInfoList.AppendElement(nsListenerInfo(listener, aNotifyMask)) ?
-         NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  mListenerInfoList.AppendElement(nsListenerInfo(listener, aNotifyMask));
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocLoader::RemoveProgressListener(nsIWebProgressListener *aListener)
 {
   return mListenerInfoList.RemoveElement(aListener) ? NS_OK : NS_ERROR_FAILURE;
 }