Bug 968520 - Add mozilla::fallible to FallibleTArray::AppendElement calls. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 28 May 2015 11:07:44 -0700
changeset 278549 2e84ad186322885a3cef208e5a3ebaa2235be7e6
parent 278548 182efe94d6b3dfe073bb2f40c61da621cd68556b
child 278550 879bc9b3298d5aebd45870717606cf07177e1b9f
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs968520
milestone41.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 968520 - Add mozilla::fallible to FallibleTArray::AppendElement calls. r=froydnj
dom/base/Console.cpp
dom/base/WebSocket.cpp
dom/base/nsDOMMutationObserver.cpp
dom/base/nsJSTimeoutHandler.cpp
dom/base/nsScreen.cpp
dom/bindings/Codegen.py
dom/camera/DOMCameraControl.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasUtils.h
dom/canvas/WebGL2ContextFramebuffers.cpp
dom/datastore/DataStoreService.cpp
dom/html/HTMLInputElement.cpp
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/mobilemessage/ipc/SmsChild.cpp
dom/security/nsCSPContext.cpp
dom/security/nsCSPUtils.cpp
dom/smil/nsSMILAnimationFunction.cpp
dom/smil/nsSMILParserUtils.cpp
dom/svg/DOMSVGPathSegList.cpp
dom/svg/SVGLengthList.h
dom/svg/SVGMotionSMILAnimationFunction.cpp
dom/svg/SVGMotionSMILPathUtils.cpp
dom/svg/SVGMotionSMILType.cpp
dom/svg/SVGNumberList.h
dom/svg/SVGPathData.cpp
dom/svg/SVGPointList.h
dom/svg/SVGStringList.h
dom/svg/SVGTransformList.h
dom/svg/SVGTransformListParser.cpp
dom/svg/SVGTransformListSMILType.cpp
dom/tv/TVSource.cpp
gfx/layers/apz/testutil/APZTestData.cpp
image/SourceBuffer.cpp
ipc/glue/IPCMessageUtils.h
layout/base/FrameLayerBuilder.cpp
layout/base/SelectionCarets.cpp
layout/base/TouchCaret.cpp
layout/style/MediaQueryList.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
netwerk/base/Dashboard.cpp
toolkit/components/url-classifier/HashStore.cpp
--- a/dom/base/Console.cpp
+++ b/dom/base/Console.cpp
@@ -663,17 +663,17 @@ private:
 
     for (uint32_t i = 0; i < length; ++i) {
       JS::Rooted<JS::Value> value(aCx);
 
       if (!JS_GetElement(aCx, argumentsObj, i, &value)) {
         return;
       }
 
-      if (!arguments.AppendElement(value)) {
+      if (!arguments.AppendElement(value, fallible)) {
         return;
       }
     }
 
     mConsole->ProfileMethod(aCx, mAction, arguments);
   }
 
   nsString mAction;
@@ -825,43 +825,43 @@ METHOD(GroupCollapsed, "groupCollapsed")
 METHOD(GroupEnd, "groupEnd")
 
 void
 Console::Time(JSContext* aCx, const JS::Handle<JS::Value> aTime)
 {
   Sequence<JS::Value> data;
   SequenceRooter<JS::Value> rooter(aCx, &data);
 
-  if (!aTime.isUndefined() && !data.AppendElement(aTime)) {
+  if (!aTime.isUndefined() && !data.AppendElement(aTime, fallible)) {
     return;
   }
 
   Method(aCx, MethodTime, NS_LITERAL_STRING("time"), data);
 }
 
 void
 Console::TimeEnd(JSContext* aCx, const JS::Handle<JS::Value> aTime)
 {
   Sequence<JS::Value> data;
   SequenceRooter<JS::Value> rooter(aCx, &data);
 
-  if (!aTime.isUndefined() && !data.AppendElement(aTime)) {
+  if (!aTime.isUndefined() && !data.AppendElement(aTime, fallible)) {
     return;
   }
 
   Method(aCx, MethodTimeEnd, NS_LITERAL_STRING("timeEnd"), data);
 }
 
 void
 Console::TimeStamp(JSContext* aCx, const JS::Handle<JS::Value> aData)
 {
   Sequence<JS::Value> data;
   SequenceRooter<JS::Value> rooter(aCx, &data);
 
-  if (aData.isString() && !data.AppendElement(aData)) {
+  if (aData.isString() && !data.AppendElement(aData, fallible)) {
     return;
   }
 
   Method(aCx, MethodTimeStamp, NS_LITERAL_STRING("timeStamp"), data);
 }
 
 void
 Console::Profile(JSContext* aCx, const Sequence<JS::Value>& aData)
@@ -891,17 +891,17 @@ Console::ProfileMethod(JSContext* aCx, c
 
   RootedDictionary<ConsoleProfileEvent> event(aCx);
   event.mAction = aAction;
 
   event.mArguments.Construct();
   Sequence<JS::Value>& sequence = event.mArguments.Value();
 
   for (uint32_t i = 0; i < aData.Length(); ++i) {
-    if (!sequence.AppendElement(aData[i])) {
+    if (!sequence.AppendElement(aData[i], fallible)) {
       return;
     }
   }
 
   JS::Rooted<JS::Value> eventValue(aCx);
   if (!ToJSValue(aCx, event, &eventValue)) {
     return;
   }
@@ -1435,17 +1435,17 @@ FlushOutput(JSContext* aCx, Sequence<JS:
   if (!aOutput.IsEmpty()) {
     JS::Rooted<JSString*> str(aCx, JS_NewUCStringCopyN(aCx,
                                                        aOutput.get(),
                                                        aOutput.Length()));
     if (!str) {
       return false;
     }
 
-    if (!aSequence.AppendElement(JS::StringValue(str))) {
+    if (!aSequence.AppendElement(JS::StringValue(str), fallible)) {
       return false;
     }
 
     aOutput.Truncate();
   }
 
   return true;
 }
@@ -1566,17 +1566,17 @@ Console::ProcessArguments(JSContext* aCx
           return false;
         }
 
         JS::Rooted<JS::Value> v(aCx);
         if (index < aData.Length()) {
           v = aData[index++];
         }
 
-        if (!aSequence.AppendElement(v)) {
+        if (!aSequence.AppendElement(v, fallible)) {
           return false;
         }
 
         break;
       }
 
       case 'c':
       {
@@ -1589,23 +1589,23 @@ Console::ProcessArguments(JSContext* aCx
           JS::Rooted<JSString*> jsString(aCx, JS::ToString(aCx, v));
           if (!jsString) {
             return false;
           }
 
           int32_t diff = aSequence.Length() - aStyles.Length();
           if (diff > 0) {
             for (int32_t i = 0; i < diff; i++) {
-              if (!aStyles.AppendElement(JS::NullValue())) {
+              if (!aStyles.AppendElement(JS::NullValue(), fallible)) {
                 return false;
               }
             }
           }
 
-          if (!aStyles.AppendElement(JS::StringValue(jsString))) {
+          if (!aStyles.AppendElement(JS::StringValue(jsString), fallible)) {
             return false;
           }
         }
         break;
       }
 
       case 's':
         if (index < aData.Length()) {
@@ -1667,17 +1667,17 @@ Console::ProcessArguments(JSContext* aCx
 
   // Discard trailing style element if there is no output to apply it to.
   if (aStyles.Length() > aSequence.Length()) {
     aStyles.TruncateLength(aSequence.Length());
   }
 
   // The rest of the array, if unused by the format string.
   for (; index < aData.Length(); ++index) {
-    if (!aSequence.AppendElement(aData[index])) {
+    if (!aSequence.AppendElement(aData[index], fallible)) {
       return false;
     }
   }
 
   return true;
 }
 
 void
@@ -1803,17 +1803,17 @@ Console::StopTimer(JSContext* aCx, const
   return value;
 }
 
 bool
 Console::ArgumentsToValueList(const nsTArray<JS::Heap<JS::Value>>& aData,
                               Sequence<JS::Value>& aSequence)
 {
   for (uint32_t i = 0; i < aData.Length(); ++i) {
-    if (!aSequence.AppendElement(aData[i])) {
+    if (!aSequence.AppendElement(aData[i], fallible)) {
       return false;
     }
   }
 
   return true;
 }
 
 JS::Value
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -955,17 +955,17 @@ WebSocket::Constructor(const GlobalObjec
 
 already_AddRefed<WebSocket>
 WebSocket::Constructor(const GlobalObject& aGlobal,
                        const nsAString& aUrl,
                        const nsAString& aProtocol,
                        ErrorResult& aRv)
 {
   Sequence<nsString> protocols;
-  if (!protocols.AppendElement(aProtocol)) {
+  if (!protocols.AppendElement(aProtocol, fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
   return WebSocket::Constructor(aGlobal, aUrl, protocols, aRv);
 }
 
 namespace {
--- a/dom/base/nsDOMMutationObserver.cpp
+++ b/dom/base/nsDOMMutationObserver.cpp
@@ -709,17 +709,18 @@ nsDOMMutationObserver::GetObservingInfo(
     info.mCharacterDataOldValue.Construct(mr->CharacterDataOldValue());
     info.mAnimations.Construct(mr->Animations());
     nsCOMArray<nsIAtom>& filters = mr->AttributeFilter();
     if (filters.Count()) {
       info.mAttributeFilter.Construct();
       mozilla::dom::Sequence<nsString>& filtersAsStrings =
         info.mAttributeFilter.Value();
       for (int32_t j = 0; j < filters.Count(); ++j) {
-        if (!filtersAsStrings.AppendElement(nsDependentAtomString(filters[j]))) {
+        if (!filtersAsStrings.AppendElement(nsDependentAtomString(filters[j]),
+                                            mozilla::fallible)) {
           aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
           return;
         }
       }
     }
     info.mObservedNode = mr->Target();
   }
 }
@@ -768,17 +769,17 @@ nsDOMMutationObserver::HandleMutation()
   if (mutations.SetCapacity(mPendingMutationCount, mozilla::fallible)) {
     // We can't use TakeRecords easily here, because it deals with a
     // different type of array, and we want to optimize out any extra copying.
     nsRefPtr<nsDOMMutationRecord> current;
     current.swap(mFirstPendingMutation);
     for (uint32_t i = 0; i < mPendingMutationCount; ++i) {
       nsRefPtr<nsDOMMutationRecord> next;
       current->mNext.swap(next);
-      *mutations.AppendElement() = current;
+      *mutations.AppendElement(mozilla::fallible) = current;
       current.swap(next);
     }
   }
   ClearPendingRecords();
 
   mozilla::ErrorResult rv;
   mCallback->Call(this, mutations, *this, rv);
 }
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -363,17 +363,17 @@ nsJSScriptTimeoutHandler::Init(nsGlobalW
     uint32_t argCount = std::max(argc, 2u) - 2;
 
     FallibleTArray<JS::Heap<JS::Value> > args;
     if (!args.SetCapacity(argCount, fallible)) {
       // No need to drop here, since we already have a non-null mFunction
       return NS_ERROR_OUT_OF_MEMORY;
     }
     for (uint32_t idx = 0; idx < argCount; ++idx) {
-      *args.AppendElement() = argv[idx + 2];
+      *args.AppendElement(fallible) = argv[idx + 2];
     }
     args.SwapElements(mArgs);
   } else {
     NS_WARNING("No func and no expr - why are we here?");
   }
   *aInterval = interval;
   return NS_OK;
 }
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -223,17 +223,17 @@ nsScreen::GetLockOrientationPermission()
   return doc->MozFullScreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
 }
 
 bool
 nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
 {
   nsString orientation(aOrientation);
   Sequence<nsString> orientations;
-  if (!orientations.AppendElement(orientation)) {
+  if (!orientations.AppendElement(orientation, fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return false;
   }
   return MozLockOrientation(orientations, aRv);
 }
 
 bool
 nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -4310,17 +4310,17 @@ def getJSToNativeConversionInfo(type, de
             while (true) {
               bool done${nestingLevel};
               if (!iter${nestingLevel}.next(&temp${nestingLevel}, &done${nestingLevel})) {
                 $*{exceptionCode}
               }
               if (done${nestingLevel}) {
                 break;
               }
-              ${elementType}* slotPtr${nestingLevel} = arr${nestingLevel}.AppendElement();
+              ${elementType}* slotPtr${nestingLevel} = arr${nestingLevel}.AppendElement(mozilla::fallible);
               if (!slotPtr${nestingLevel}) {
                 JS_ReportOutOfMemory(cx);
                 $*{exceptionCode}
               }
               ${elementType}& slot${nestingLevel} = *slotPtr${nestingLevel};
               $*{elementConversion}
             }
             """,
@@ -5605,17 +5605,17 @@ class CGArgumentConverter(CGThing):
             rooterDecl +
             dedent("""
                 if (${argc} > ${index}) {
                   if (!${declName}.SetCapacity(${argc} - ${index}, mozilla::fallible)) {
                     JS_ReportOutOfMemory(cx);
                     return false;
                   }
                   for (uint32_t variadicArg = ${index}; variadicArg < ${argc}; ++variadicArg) {
-                    ${elemType}& slot = *${declName}.AppendElement();
+                    ${elemType}& slot = *${declName}.AppendElement(mozilla::fallible);
                 """)
         ).substitute(replacer)
 
         val = string.Template("args[variadicArg]").substitute(replacer)
         variadicConversion += indent(
             string.Template(typeConversion.template).substitute({
                 "val": val,
                 "declName": "slot",
--- a/dom/camera/DOMCameraControl.cpp
+++ b/dom/camera/DOMCameraControl.cpp
@@ -1371,17 +1371,17 @@ nsDOMCameraControl::OnFacesDetected(cons
   DOM_CAMERA_LOGI("DOM OnFacesDetected %zu face(s)\n", aFaces.Length());
   MOZ_ASSERT(NS_IsMainThread());
 
   Sequence<OwningNonNull<DOMCameraDetectedFace> > faces;
   uint32_t len = aFaces.Length();
 
   if (faces.SetCapacity(len, fallible)) {
     for (uint32_t i = 0; i < len; ++i) {
-      *faces.AppendElement() =
+      *faces.AppendElement(fallible) =
         new DOMCameraDetectedFace(static_cast<DOMMediaStream*>(this), aFaces[i]);
     }
   }
 
   CameraFacesDetectedEventInit eventInit;
   eventInit.mFaces.SetValue(faces);
 
   nsRefPtr<CameraFacesDetectedEvent> event =
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2671,17 +2671,17 @@ void CanvasRenderingContext2D::DrawFocus
     // set the background focus color
     CurrentState().SetColorStyle(Style::STROKE, NS_RGBA(255, 255, 255, 255));
     // draw the focus ring
     Stroke();
 
     // set dashing for foreground
     FallibleTArray<mozilla::gfx::Float>& dash = CurrentState().dash;
     for (uint32_t i = 0; i < 2; ++i) {
-      if (!dash.AppendElement(1)) {
+      if (!dash.AppendElement(1, fallible)) {
         aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return;
       }
     }
 
     // set the foreground focus color
     CurrentState().SetColorStyle(Style::STROKE, NS_RGBA(0,0,0, 255));
     // draw the focus ring
@@ -3959,24 +3959,24 @@ CanvasRenderingContext2D::SetLineDash(co
 
   for (uint32_t x = 0; x < aSegments.Length(); x++) {
     if (aSegments[x] < 0.0) {
       // Pattern elements must be finite "numbers" >= 0, with "finite"
       // taken care of by WebIDL
       return;
     }
 
-    if (!dash.AppendElement(aSegments[x])) {
+    if (!dash.AppendElement(aSegments[x], fallible)) {
       aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
       return;
     }
   }
   if (aSegments.Length() % 2) { // If the number of elements is odd, concatenate again
     for (uint32_t x = 0; x < aSegments.Length(); x++) {
-      if (!dash.AppendElement(aSegments[x])) {
+      if (!dash.AppendElement(aSegments[x], fallible)) {
         aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return;
       }
     }
   }
 
   CurrentState().dash = dash;
 }
--- a/dom/canvas/CanvasUtils.h
+++ b/dom/canvas/CanvasUtils.h
@@ -124,17 +124,17 @@ JSValToDashArray(JSContext* cx, const JS
             if (!(CoerceDouble(elt, &d) &&
                   FloatValidate(d) &&
                   d >= 0.0)) {
                 // Pattern elements must be finite "numbers" >= 0.
                 return NS_ERROR_INVALID_ARG;
             } else if (d > 0.0) {
                 haveNonzeroElement = true;
             }
-            if (!dashes.AppendElement(d)) {
+            if (!dashes.AppendElement(d, mozilla::fallible)) {
                 return NS_ERROR_OUT_OF_MEMORY;
             }
         }
 
         if (dashes.Length() > 0 && !haveNonzeroElement) {
             // An all-zero pattern makes no sense.
             return NS_ERROR_ILLEGAL_VALUE;
         }
--- a/dom/canvas/WebGL2ContextFramebuffers.cpp
+++ b/dom/canvas/WebGL2ContextFramebuffers.cpp
@@ -344,29 +344,29 @@ WebGL2Context::GetInternalformatParamete
 // Map attachments intended for the default buffer, to attachments for a non-
 // default buffer.
 static bool
 TranslateDefaultAttachments(const dom::Sequence<GLenum>& in, dom::Sequence<GLenum>* out)
 {
     for (size_t i = 0; i < in.Length(); i++) {
         switch (in[i]) {
             case LOCAL_GL_COLOR:
-                if (!out->AppendElement(LOCAL_GL_COLOR_ATTACHMENT0)) {
+                if (!out->AppendElement(LOCAL_GL_COLOR_ATTACHMENT0, fallible)) {
                     return false;
                 }
                 break;
 
             case LOCAL_GL_DEPTH:
-                if (!out->AppendElement(LOCAL_GL_DEPTH_ATTACHMENT)) {
+                if (!out->AppendElement(LOCAL_GL_DEPTH_ATTACHMENT, fallible)) {
                     return false;
                 }
                 break;
 
             case LOCAL_GL_STENCIL:
-                if (!out->AppendElement(LOCAL_GL_STENCIL_ATTACHMENT)) {
+                if (!out->AppendElement(LOCAL_GL_STENCIL_ATTACHMENT, fallible)) {
                     return false;
                 }
                 break;
         }
     }
 
     return true;
 }
--- a/dom/datastore/DataStoreService.cpp
+++ b/dom/datastore/DataStoreService.cpp
@@ -1353,17 +1353,17 @@ DataStoreService::CreateFirstRevisionId(
   MOZ_ASSERT(NS_IsMainThread());
 
   nsRefPtr<DataStoreDB> db = new DataStoreDB(aManifestURL, aName);
 
   nsRefPtr<FirstRevisionIdCallback> callback =
     new FirstRevisionIdCallback(aAppId, aName, aManifestURL);
 
   Sequence<nsString> dbs;
-  if (!dbs.AppendElement(NS_LITERAL_STRING(DATASTOREDB_REVISION))) {
+  if (!dbs.AppendElement(NS_LITERAL_STRING(DATASTOREDB_REVISION), fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return db->Open(IDBTransactionMode::Readwrite, dbs, callback);
 }
 
 nsresult
 DataStoreService::EnableDataStore(uint32_t aAppId, const nsAString& aName,
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1855,17 +1855,17 @@ HTMLInputElement::SetValue(const nsAStri
     if (!aValue.IsEmpty()) {
       if (!nsContentUtils::IsCallerChrome()) {
         // setting the value of a "FILE" input widget requires
         // chrome privilege
         aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
         return;
       }
       Sequence<nsString> list;
-      if (!list.AppendElement(aValue)) {
+      if (!list.AppendElement(aValue, fallible)) {
         aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return;
       }
 
       MozSetFileNameArray(list, aRv);
       return;
     }
     else {
@@ -2440,17 +2440,17 @@ HTMLInputElement::MozSetFileNameArray(co
 {
   if (!nsContentUtils::IsCallerChrome()) {
     // setting the value of a "FILE" input widget requires chrome privilege
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   Sequence<nsString> list;
   for (uint32_t i = 0; i < aLength; ++i) {
-    if (!list.AppendElement(nsDependentString(aFileNames[i]))) {
+    if (!list.AppendElement(nsDependentString(aFileNames[i]), fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
 
   ErrorResult rv;
   MozSetFileNameArray(list, rv);
   return rv.StealNSResult();
 }
@@ -2493,17 +2493,17 @@ HTMLInputElement::SetUserInput(const nsA
 {
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   if (mType == NS_FORM_INPUT_FILE)
   {
     Sequence<nsString> list;
-    if (!list.AppendElement(aValue)) {
+    if (!list.AppendElement(aValue, fallible)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     ErrorResult rv;
     MozSetFileNameArray(list, rv);
     return rv.StealNSResult();
   } else {
     nsresult rv = SetValueInternal(aValue, true, true);
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -8516,25 +8516,25 @@ ConvertBlobsToActors(PBackgroundParent* 
     PBlobParent* actor =
       BackgroundParent::GetOrCreateActorForBlobImpl(aBackgroundActor, impl);
     if (!actor) {
       // This can only fail if the child has crashed.
       IDB_REPORT_INTERNAL_ERR();
       return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
     }
 
-    MOZ_ALWAYS_TRUE(aActors.AppendElement(actor));
+    MOZ_ALWAYS_TRUE(aActors.AppendElement(actor, fallible));
 
     if (collectFileInfos) {
       nsRefPtr<FileInfo> fileInfo = file.mFileInfo;
 
       // Transfer a reference to the receiver.
       auto transferedFileInfo =
         reinterpret_cast<intptr_t>(fileInfo.forget().take());
-      MOZ_ALWAYS_TRUE(aFileInfos.AppendElement(transferedFileInfo));
+      MOZ_ALWAYS_TRUE(aFileInfos.AppendElement(transferedFileInfo, fallible));
     }
   }
 
   return NS_OK;
 }
 
 /*******************************************************************************
  * Globals
@@ -12353,17 +12353,17 @@ Database::Invalidate()
     Collect(nsPtrHashKey<TransactionBase>* aEntry, void* aUserData)
     {
       AssertIsOnBackgroundThread();
       MOZ_ASSERT(aUserData);
 
       auto* array =
         static_cast<FallibleTArray<nsRefPtr<TransactionBase>>*>(aUserData);
 
-      if (NS_WARN_IF(!array->AppendElement(aEntry->GetKey()))) {
+      if (NS_WARN_IF(!array->AppendElement(aEntry->GetKey(), fallible))) {
         return PL_DHASH_STOP;
       }
 
       return PL_DHASH_NEXT;
     }
   };
 
   if (mInvalidated) {
@@ -12621,17 +12621,17 @@ Database::AllocPBackgroundIDBTransaction
       MOZ_ASSERT(aKey);
       MOZ_ASSERT(aValue);
       MOZ_ASSERT(aClosure);
 
       auto* closure = static_cast<Closure*>(aClosure);
 
       if (closure->mName == aValue->mCommonMetadata.name() &&
           !aValue->mDeleted) {
-        MOZ_ALWAYS_TRUE(closure->mObjectStores.AppendElement(aValue));
+        MOZ_ALWAYS_TRUE(closure->mObjectStores.AppendElement(aValue, fallible));
         return PL_DHASH_STOP;
       }
 
       return PL_DHASH_NEXT;
     }
   };
 
   // Once a database is closed it must not try to open new transactions.
@@ -18780,17 +18780,17 @@ FactoryOp::SendVersionChangeMessages(Dat
   const uint32_t expectedCount = mDeleting ? 0 : 1;
   const uint32_t liveCount = aDatabaseActorInfo->mLiveDatabases.Length();
   if (liveCount > expectedCount) {
     FallibleTArray<MaybeBlockedDatabaseInfo> maybeBlockedDatabases;
     for (uint32_t index = 0; index < liveCount; index++) {
       Database* database = aDatabaseActorInfo->mLiveDatabases[index];
       if ((!aOpeningDatabase || database != aOpeningDatabase) &&
           !database->IsClosed() &&
-          NS_WARN_IF(!maybeBlockedDatabases.AppendElement(database))) {
+          NS_WARN_IF(!maybeBlockedDatabases.AppendElement(database, fallible))) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
     }
 
     if (!maybeBlockedDatabases.IsEmpty()) {
       mMaybeBlockedDatabases.SwapElements(maybeBlockedDatabases);
     }
   }
@@ -23042,17 +23042,17 @@ ObjectStoreAddOrPutRequestOp::Init(Trans
 
     for (uint32_t index = 0; index < count; index++) {
       const DatabaseFileOrMutableFileId& fileOrFileId = files[index];
       MOZ_ASSERT(fileOrFileId.type() ==
                    DatabaseFileOrMutableFileId::
                      TPBackgroundIDBDatabaseFileParent ||
                  fileOrFileId.type() == DatabaseFileOrMutableFileId::Tint64_t);
 
-      StoredFileInfo* storedFileInfo = mStoredFileInfos.AppendElement();
+      StoredFileInfo* storedFileInfo = mStoredFileInfos.AppendElement(fallible);
       MOZ_ASSERT(storedFileInfo);
 
       switch (fileOrFileId.type()) {
         case DatabaseFileOrMutableFileId::TPBackgroundIDBDatabaseFileParent: {
           storedFileInfo->mFileActor =
             static_cast<DatabaseFile*>(
               fileOrFileId.get_PBackgroundIDBDatabaseFileParent());
           MOZ_ASSERT(storedFileInfo->mFileActor);
@@ -23605,17 +23605,17 @@ ObjectStoreGetRequestOp::DoDatabaseWork(
                                  stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement();
+    StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!cloneInfo)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = GetStructuredCloneReadInfoFromStatement(stmt, 1, 0, mFileManager,
                                                  cloneInfo);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
@@ -23732,17 +23732,17 @@ ObjectStoreGetAllKeysRequestOp::DoDataba
       stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while(NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    Key* key = mResponse.AppendElement();
+    Key* key = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!key)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = key->SetFromStatement(stmt, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -24154,17 +24154,17 @@ IndexGetRequestOp::DoDatabaseWork(Databa
                                  stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while(NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement();
+    StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!cloneInfo)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = GetStructuredCloneReadInfoFromStatement(stmt, 1, 0, mFileManager,
                                                  cloneInfo);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
@@ -24346,17 +24346,17 @@ IndexGetKeyRequestOp::DoDatabaseWork(Dat
                                  stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while(NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
-    Key* key = mResponse.AppendElement();
+    Key* key = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!key)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = key->SetFromStatement(stmt, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1225,24 +1225,27 @@ IDBObjectStore::AddOrPut(JSContext* aCx,
         PBackgroundIDBDatabaseFileChild* fileActor =
           database->GetOrCreateFileActorForBlob(blobOrFileInfo.mBlob);
         if (NS_WARN_IF(!fileActor)) {
           IDB_REPORT_INTERNAL_ERR();
           aRv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
           return nullptr;
         }
 
-        MOZ_ALWAYS_TRUE(fileActorOrMutableFileIds.AppendElement(fileActor));
+        MOZ_ALWAYS_TRUE(fileActorOrMutableFileIds.AppendElement(fileActor,
+                                                                fallible));
       } else {
         const int64_t fileId = blobOrFileInfo.mFileInfo->Id();
         MOZ_ASSERT(fileId > 0);
 
-        MOZ_ALWAYS_TRUE(fileActorOrMutableFileIds.AppendElement(fileId));
+        MOZ_ALWAYS_TRUE(fileActorOrMutableFileIds.AppendElement(fileId,
+                                                                fallible));
 
-        nsRefPtr<FileInfo>* newFileInfo = fileInfosToKeepAlive.AppendElement();
+        nsRefPtr<FileInfo>* newFileInfo =
+          fileInfosToKeepAlive.AppendElement(fallible);
         if (NS_WARN_IF(!newFileInfo)) {
           aRv = NS_ERROR_OUT_OF_MEMORY;
           return nullptr;
         }
 
         newFileInfo->swap(blobOrFileInfo.mFileInfo);
       }
     }
--- a/dom/mobilemessage/ipc/SmsChild.cpp
+++ b/dom/mobilemessage/ipc/SmsChild.cpp
@@ -350,18 +350,18 @@ MobileMessageCursorChild::DoNotifyResult
   AutoFallibleTArray<nsISupports*, 1> autoArray;
   NS_ENSURE_TRUE_VOID(autoArray.SetCapacity(length, fallible));
 
   AutoFallibleTArray<nsCOMPtr<nsISupports>, 1> messages;
   NS_ENSURE_TRUE_VOID(messages.SetCapacity(length, fallible));
 
   for (uint32_t i = 0; i < length; i++) {
     nsCOMPtr<nsISupports> message = CreateMessageFromMessageData(aDataArray[i]);
-    NS_ENSURE_TRUE_VOID(messages.AppendElement(message));
-    NS_ENSURE_TRUE_VOID(autoArray.AppendElement(message.get()));
+    NS_ENSURE_TRUE_VOID(messages.AppendElement(message, fallible));
+    NS_ENSURE_TRUE_VOID(autoArray.AppendElement(message.get(), fallible));
   }
 
   mCursorCallback->NotifyCursorResult(autoArray.Elements(), length);
 }
 
 void
 MobileMessageCursorChild::DoNotifyResult(const nsTArray<ThreadData>& aDataArray)
 {
@@ -371,18 +371,18 @@ MobileMessageCursorChild::DoNotifyResult
   AutoFallibleTArray<nsISupports*, 1> autoArray;
   NS_ENSURE_TRUE_VOID(autoArray.SetCapacity(length, fallible));
 
   AutoFallibleTArray<nsCOMPtr<nsISupports>, 1> threads;
   NS_ENSURE_TRUE_VOID(threads.SetCapacity(length, fallible));
 
   for (uint32_t i = 0; i < length; i++) {
     nsCOMPtr<nsISupports> thread = new MobileMessageThread(aDataArray[i]);
-    NS_ENSURE_TRUE_VOID(threads.AppendElement(thread));
-    NS_ENSURE_TRUE_VOID(autoArray.AppendElement(thread.get()));
+    NS_ENSURE_TRUE_VOID(threads.AppendElement(thread, fallible));
+    NS_ENSURE_TRUE_VOID(autoArray.AppendElement(thread.get(), fallible));
   }
 
   mCursorCallback->NotifyCursorResult(autoArray.Elements(), length);
 }
 
 } // namespace mobilemessage
 } // namespace dom
 } // namespace mozilla
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -1192,17 +1192,17 @@ nsCSPContext::ToJSON(nsAString& outCSPin
 {
   outCSPinJSON.Truncate();
   dom::CSPPolicies jsonPolicies;
   jsonPolicies.mCsp_policies.Construct();
 
   for (uint32_t p = 0; p < mPolicies.Length(); p++) {
     dom::CSP jsonCSP;
     mPolicies[p]->toDomCSPStruct(jsonCSP);
-    jsonPolicies.mCsp_policies.Value().AppendElement(jsonCSP);
+    jsonPolicies.mCsp_policies.Value().AppendElement(jsonCSP, fallible);
   }
 
   // convert the gathered information to JSON
   if (!jsonPolicies.ToJSON(outCSPinJSON)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
--- a/dom/security/nsCSPUtils.cpp
+++ b/dom/security/nsCSPUtils.cpp
@@ -772,17 +772,17 @@ nsCSPDirective::toString(nsAString& outS
 void
 nsCSPDirective::toDomCSPStruct(mozilla::dom::CSP& outCSP) const
 {
   mozilla::dom::Sequence<nsString> srcs;
   nsString src;
   for (uint32_t i = 0; i < mSrcs.Length(); i++) {
     src.Truncate();
     mSrcs[i]->toString(src);
-    srcs.AppendElement(src);
+    srcs.AppendElement(src, mozilla::fallible);
   }
 
   switch(mDirective) {
     case nsIContentSecurityPolicy::DEFAULT_SRC_DIRECTIVE:
       outCSP.mDefault_src.Construct();
       outCSP.mDefault_src.Value() = srcs;
       return;
 
@@ -1026,17 +1026,17 @@ nsCSPPolicy::toString(nsAString& outStr)
 void
 nsCSPPolicy::toDomCSPStruct(mozilla::dom::CSP& outCSP) const
 {
   outCSP.mReport_only = mReportOnly;
 
   for (uint32_t i = 0; i < mDirectives.Length(); ++i) {
     if (mDirectives[i]->equals(nsIContentSecurityPolicy::REFERRER_DIRECTIVE)) {
       mozilla::dom::Sequence<nsString> srcs;
-      srcs.AppendElement(mReferrerPolicy);
+      srcs.AppendElement(mReferrerPolicy, mozilla::fallible);
       outCSP.mReferrer.Construct();
       outCSP.mReferrer.Value() = srcs;
     } else {
       mDirectives[i]->toDomCSPStruct(outCSP);
     }
   }
 }
 
--- a/dom/smil/nsSMILAnimationFunction.cpp
+++ b/dom/smil/nsSMILAnimationFunction.cpp
@@ -782,30 +782,30 @@ nsSMILAnimationFunction::GetValues(const
 
     if (!parseOk || !result.SetCapacity(2, mozilla::fallible)) {
       return NS_ERROR_FAILURE;
     }
 
     // AppendElement() below must succeed, because SetCapacity() succeeded.
     if (!to.IsNull()) {
       if (!from.IsNull()) {
-        MOZ_ALWAYS_TRUE(result.AppendElement(from));
-        MOZ_ALWAYS_TRUE(result.AppendElement(to));
+        MOZ_ALWAYS_TRUE(result.AppendElement(from, mozilla::fallible));
+        MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
       } else {
-        MOZ_ALWAYS_TRUE(result.AppendElement(to));
+        MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
       }
     } else if (!by.IsNull()) {
       nsSMILValue effectiveFrom(by.mType);
       if (!from.IsNull())
         effectiveFrom = from;
       // Set values to 'from; from + by'
-      MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom));
+      MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom, mozilla::fallible));
       nsSMILValue effectiveTo(effectiveFrom);
       if (!effectiveTo.IsNull() && NS_SUCCEEDED(effectiveTo.Add(by))) {
-        MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo));
+        MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo, mozilla::fallible));
       } else {
         // Using by-animation with non-additive type or bad base-value
         return NS_ERROR_FAILURE;
       }
     } else {
       // No values, no to, no by -- call it a day
       return NS_ERROR_FAILURE;
     }
--- a/dom/smil/nsSMILParserUtils.cpp
+++ b/dom/smil/nsSMILParserUtils.cpp
@@ -530,17 +530,18 @@ nsSMILParserUtils::ParseKeySplines(const
         return false;
       }
     }
     if (tokenizer.hasMoreTokens() ||
         tokenizer.separatorAfterCurrentToken() ||
         !aKeySplines.AppendElement(nsSMILKeySpline(values[0],
                                                    values[1],
                                                    values[2],
-                                                   values[3]))) {
+                                                   values[3]),
+                                   fallible)) {
       return false;
     }
   }
 
   return !aKeySplines.IsEmpty();
 }
 
 bool
@@ -558,17 +559,17 @@ nsSMILParserUtils::ParseSemicolonDelimit
       return false;
     }
 
     if (value > 1.0 || value < 0.0 ||
         (aNonDecreasing && value < previousValue)) {
       return false;
     }
 
-    if (!aArray.AppendElement(value)) {
+    if (!aArray.AppendElement(value, fallible)) {
       return false;
     }
     previousValue = value;
   }
 
   return !aArray.IsEmpty();
 }
 
@@ -589,17 +590,17 @@ public:
 
   virtual bool Parse(const nsAString& aValueStr) override {
     nsSMILValue newValue;
     bool tmpPreventCachingOfSandwich = false;
     if (NS_FAILED(mSMILAttr->ValueFromString(aValueStr, mSrcElement, newValue,
                                              tmpPreventCachingOfSandwich)))
       return false;
 
-    if (!mValuesArray->AppendElement(newValue)) {
+    if (!mValuesArray->AppendElement(newValue, fallible)) {
       return false;
     }
     if (tmpPreventCachingOfSandwich) {
       *mPreventCachingOfSandwich = true;
     }
     return true;
   }
 protected:
--- a/dom/svg/DOMSVGPathSegList.cpp
+++ b/dom/svg/DOMSVGPathSegList.cpp
@@ -216,17 +216,17 @@ DOMSVGPathSegList::InternalListWillChang
     // Sync mItems:
     while (dataIndex < dataLength) {
       if (mItems.Length() &&
           mItems.Length() - 1 > DOMSVGPathSeg::MaxListIndex()) {
         // It's safe to get out of sync with our internal list as long as we
         // have FEWER items than it does.
         return;
       }
-      if (!mItems.AppendElement(ItemProxy(nullptr, dataIndex))) {
+      if (!mItems.AppendElement(ItemProxy(nullptr, dataIndex), fallible)) {
         // OOM
         ErrorResult rv;
         Clear(rv);
         MOZ_ASSERT(!rv.Failed());
         return;
       }
       dataIndex += 1 + SVGPathSegUtils::ArgCountForType(SVGPathSegUtils::DecodeType(aNewValue.mData[dataIndex]));
     }
--- a/dom/svg/SVGLengthList.h
+++ b/dom/svg/SVGLengthList.h
@@ -118,17 +118,17 @@ private:
 
   void RemoveItem(uint32_t aIndex) {
     MOZ_ASSERT(aIndex < mLengths.Length(),
                "DOM wrapper caller should have raised INDEX_SIZE_ERR");
     mLengths.RemoveElementAt(aIndex);
   }
 
   bool AppendItem(SVGLength aLength) {
-    return !!mLengths.AppendElement(aLength);
+    return !!mLengths.AppendElement(aLength, fallible);
   }
 
 protected:
 
   /* Rationale for using nsTArray<SVGLength> and not nsTArray<SVGLength, 1>:
    *
    * It might seem like we should use nsAutoTArray<SVGLength, 1> instead of
    * nsTArray<SVGLength>. That would preallocate space for one SVGLength and
--- a/dom/svg/SVGMotionSMILAnimationFunction.cpp
+++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp
@@ -169,25 +169,25 @@ SVGMotionSMILAnimationFunction::
     SVGMotionSMILPathUtils::MotionValueParser parser(&pathGenerator,
                                                      &mPathVertices);
     success = nsSMILParserUtils::ParseValuesGeneric(valuesStr, parser);
   } else if (HasAttr(nsGkAtoms::to) || HasAttr(nsGkAtoms::by)) {
     // Apply 'from' value (or a dummy 0,0 'from' value)
     if (HasAttr(nsGkAtoms::from)) {
       const nsAString& fromStr = GetAttr(nsGkAtoms::from)->GetStringValue();
       success = pathGenerator.MoveToAbsolute(fromStr);
-      mPathVertices.AppendElement(0.0);
+      mPathVertices.AppendElement(0.0, fallible);
     } else {
       // Create dummy 'from' value at 0,0, if we're doing by-animation.
       // (NOTE: We don't add the dummy 0-point to our list for *to-animation*,
       // because the nsSMILAnimationFunction logic for to-animation doesn't
       // expect a dummy value. It only expects one value: the final 'to' value.)
       pathGenerator.MoveToOrigin();
       if (!HasAttr(nsGkAtoms::to)) {
-        mPathVertices.AppendElement(0.0);
+        mPathVertices.AppendElement(0.0, fallible);
       }
       success = true;
     }
 
     // Apply 'to' or 'by' value
     if (success) {
       double dist;
       if (HasAttr(nsGkAtoms::to)) {
@@ -195,17 +195,17 @@ SVGMotionSMILAnimationFunction::
         const nsAString& toStr = GetAttr(nsGkAtoms::to)->GetStringValue();
         success = pathGenerator.LineToAbsolute(toStr, dist);
       } else { // HasAttr(nsGkAtoms::by)
         mPathSourceType = ePathSourceType_ByAttr;
         const nsAString& byStr = GetAttr(nsGkAtoms::by)->GetStringValue();
         success = pathGenerator.LineToRelative(byStr, dist);
       }
       if (success) {
-        mPathVertices.AppendElement(dist);
+        mPathVertices.AppendElement(dist, fallible);
       }
     }
   }
   if (success) {
     mPath = pathGenerator.GetResultingPath();
   } else {
     // Parse failure. Leave path as null, and clear path-related member data.
     mPathVertices.Clear();
@@ -303,17 +303,18 @@ SVGMotionSMILAnimationFunction::
   // If we're using "keyPoints" as our list of input distances, then we need
   // to de-normalize from the [0, 1] scale to the [0, totalPathLen] scale.
   double distanceMultiplier = aIsKeyPoints ? aPath->ComputeLength() : 1.0;
   const uint32_t numPoints = aPointDistances.Length();
   for (uint32_t i = 0; i < numPoints; ++i) {
     double curDist = aPointDistances[i] * distanceMultiplier;
     if (!aResult.AppendElement(
           SVGMotionSMILType::ConstructSMILValue(aPath, curDist,
-                                                mRotateType, mRotateAngle))) {
+                                                mRotateType, mRotateAngle),
+          fallible)) {
       return false;
     }
   }
   return true;
 }
 
 nsresult
 SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
--- a/dom/svg/SVGMotionSMILPathUtils.cpp
+++ b/dom/svg/SVGMotionSMILPathUtils.cpp
@@ -131,22 +131,22 @@ bool
 SVGMotionSMILPathUtils::MotionValueParser::
   Parse(const nsAString& aValueStr)
 {
   bool success;
   if (!mPathGenerator->HaveReceivedCommands()) {
     // Interpret first value in "values" attribute as the path's initial MoveTo
     success = mPathGenerator->MoveToAbsolute(aValueStr);
     if (success) {
-      success = !!mPointDistances->AppendElement(0.0);
+      success = !!mPointDistances->AppendElement(0.0, fallible);
     }
   } else {
     double dist;
     success = mPathGenerator->LineToAbsolute(aValueStr, dist);
     if (success) {
       mDistanceSoFar += dist;
-      success = !!mPointDistances->AppendElement(mDistanceSoFar);
+      success = !!mPointDistances->AppendElement(mDistanceSoFar, fallible);
     }
   }
   return success;
 }
 
 } // namespace mozilla
--- a/dom/svg/SVGMotionSMILType.cpp
+++ b/dom/svg/SVGMotionSMILType.cpp
@@ -320,17 +320,17 @@ SVGMotionSMILType::SandwichAdd(nsSMILVal
   MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
   MotionSegmentArray& dstArr = ExtractMotionSegmentArray(aDest);
   const MotionSegmentArray& srcArr = ExtractMotionSegmentArray(aValueToAdd);
 
   // We're only expecting to be adding 1 segment on to the list
   MOZ_ASSERT(srcArr.Length() == 1,
              "Trying to do sandwich add of more than one value");
 
-  if (!dstArr.AppendElement(srcArr[0])) {
+  if (!dstArr.AppendElement(srcArr[0], fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   
   return NS_OK;
 }
 
 nsresult
 SVGMotionSMILType::ComputeDistance(const nsSMILValue& aFrom,
@@ -437,17 +437,18 @@ SVGMotionSMILType::Interpolate(const nsS
   // Get the interpolated distance along our path.
   float resultDist = InterpolateFloat(startDist, endParams.mDistToPoint,
                                       aUnitDistance);
 
   // Construct the intermediate result segment, and put it in our outparam.
   // AppendElement has guaranteed success here, since Init() allocates 1 slot.
   MOZ_ALWAYS_TRUE(resultArr.AppendElement(MotionSegment(path, resultDist,
                                                         rotateType,
-                                                        rotateAngle)));
+                                                        rotateAngle),
+                                          fallible));
   return NS_OK;
 }
 
 /* static */ gfx::Matrix
 SVGMotionSMILType::CreateMatrix(const nsSMILValue& aSMILVal)
 {
   const MotionSegmentArray& arr = ExtractMotionSegmentArray(aSMILVal);
 
@@ -480,13 +481,14 @@ SVGMotionSMILType::ConstructSMILValue(Pa
                                       RotateType aRotateType,
                                       float aRotateAngle)
 {
   nsSMILValue smilVal(&SVGMotionSMILType::sSingleton);
   MotionSegmentArray& arr = ExtractMotionSegmentArray(smilVal);
 
   // AppendElement has guaranteed success here, since Init() allocates 1 slot.
   MOZ_ALWAYS_TRUE(arr.AppendElement(MotionSegment(aPath, aDist,
-                                                  aRotateType, aRotateAngle)));
+                                                  aRotateType, aRotateAngle),
+                                    fallible));
   return smilVal;
 }
 
 } // namespace mozilla
--- a/dom/svg/SVGNumberList.h
+++ b/dom/svg/SVGNumberList.h
@@ -121,17 +121,17 @@ private:
 
   void RemoveItem(uint32_t aIndex) {
     MOZ_ASSERT(aIndex < mNumbers.Length(),
                "DOM wrapper caller should have raised INDEX_SIZE_ERR");
     mNumbers.RemoveElementAt(aIndex);
   }
 
   bool AppendItem(float aNumber) {
-    return !!mNumbers.AppendElement(aNumber);
+    return !!mNumbers.AppendElement(aNumber, fallible);
   }
 
 protected:
 
   /* See SVGLengthList for the rationale for using FallibleTArray<float> instead
    * of FallibleTArray<float, 1>.
    */
   FallibleTArray<float> mNumbers;
--- a/dom/svg/SVGPathData.cpp
+++ b/dom/svg/SVGPathData.cpp
@@ -170,17 +170,17 @@ SVGPathData::GetDistancesFromOriginToEnd
     // http://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement
     //
     // This is important in the non-default case of calcMode="linear". In
     // this case an equal amount of time is spent on each path segment,
     // except on moveto segments which are jumped over immediately.
 
     if (i == 0 || (segType != PATHSEG_MOVETO_ABS &&
                    segType != PATHSEG_MOVETO_REL)) {
-      if (!aOutput->AppendElement(state.length)) {
+      if (!aOutput->AppendElement(state.length, fallible)) {
         return false;
       }
     }
     i += 1 + SVGPathSegUtils::ArgCountForType(segType);
   }
 
   MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt?");
 
--- a/dom/svg/SVGPointList.h
+++ b/dom/svg/SVGPointList.h
@@ -129,17 +129,17 @@ private:
 
   void RemoveItem(uint32_t aIndex) {
     MOZ_ASSERT(aIndex < mItems.Length(),
                "DOM wrapper caller should have raised INDEX_SIZE_ERR");
     mItems.RemoveElementAt(aIndex);
   }
 
   bool AppendItem(SVGPoint aPoint) {
-    return !!mItems.AppendElement(aPoint);
+    return !!mItems.AppendElement(aPoint, fallible);
   }
 
 protected:
 
   /* See SVGLengthList for the rationale for using FallibleTArray<SVGPoint> instead
    * of FallibleTArray<SVGPoint, 1>.
    */
   FallibleTArray<SVGPoint> mItems;
--- a/dom/svg/SVGStringList.h
+++ b/dom/svg/SVGStringList.h
@@ -120,17 +120,17 @@ private:
 
   void RemoveItem(uint32_t aIndex) {
     MOZ_ASSERT(aIndex < mStrings.Length(),
                "DOM wrapper caller should have raised INDEX_SIZE_ERR");
     mStrings.RemoveElementAt(aIndex);
   }
 
   bool AppendItem(const nsAString &aString) {
-    if (mStrings.AppendElement(aString)) {
+    if (mStrings.AppendElement(aString, fallible)) {
       mIsSet = true;
       return true;
     }
     return false;
   }
 
 protected:
 
--- a/dom/svg/SVGTransformList.h
+++ b/dom/svg/SVGTransformList.h
@@ -124,17 +124,17 @@ private:
 
   void RemoveItem(uint32_t aIndex) {
     MOZ_ASSERT(aIndex < mItems.Length(),
                "DOM wrapper caller should have raised INDEX_SIZE_ERR");
     mItems.RemoveElementAt(aIndex);
   }
 
   bool AppendItem(const nsSVGTransform& aTransform) {
-    return !!mItems.AppendElement(aTransform);
+    return !!mItems.AppendElement(aTransform, fallible);
   }
 
 protected:
   /*
    * See SVGLengthList for the rationale for using FallibleTArray<nsSVGTransform>
    * instead of FallibleTArray<nsSVGTransform, 1>.
    */
   FallibleTArray<nsSVGTransform> mItems;
--- a/dom/svg/SVGTransformListParser.cpp
+++ b/dom/svg/SVGTransformListParser.cpp
@@ -141,17 +141,17 @@ SVGTransformListParser::ParseTranslate()
   }
 
   switch (count) {
     case 1:
       t[1] = 0.f;
       // fall-through
     case 2:
     {
-      nsSVGTransform* transform = mTransforms.AppendElement();
+      nsSVGTransform* transform = mTransforms.AppendElement(fallible);
       if (!transform) {
         return false;
       }
       transform->SetTranslate(t[0], t[1]);
       return true;
     }
   }
 
@@ -169,17 +169,17 @@ SVGTransformListParser::ParseScale()
   }
 
   switch (count) {
     case 1:
       s[1] = s[0];
       // fall-through
     case 2:
     {
-      nsSVGTransform* transform = mTransforms.AppendElement();
+      nsSVGTransform* transform = mTransforms.AppendElement(fallible);
       if (!transform) {
         return false;
       }
       transform->SetScale(s[0], s[1]);
       return true;
     }
   }
 
@@ -198,17 +198,17 @@ SVGTransformListParser::ParseRotate()
   }
 
   switch (count) {
     case 1:
       r[1] = r[2] = 0.f;
       // fall-through
     case 3:
     {
-      nsSVGTransform* transform = mTransforms.AppendElement();
+      nsSVGTransform* transform = mTransforms.AppendElement(fallible);
       if (!transform) {
         return false;
       }
       transform->SetRotate(r[0], r[1], r[2]);
       return true;
     }
   }
 
@@ -220,17 +220,17 @@ SVGTransformListParser::ParseSkewX()
 {
   float skew;
   uint32_t count;
 
   if (!ParseArguments(&skew, 1, &count) || count != 1) {
     return false;
   }
 
-  nsSVGTransform* transform = mTransforms.AppendElement();
+  nsSVGTransform* transform = mTransforms.AppendElement(fallible);
   if (!transform) {
     return false;
   }
   transform->SetSkewX(skew);
 
   return true;
 }
 
@@ -239,17 +239,17 @@ SVGTransformListParser::ParseSkewY()
 {
   float skew;
   uint32_t count;
 
   if (!ParseArguments(&skew, 1, &count) || count != 1) {
     return false;
   }
 
-  nsSVGTransform* transform = mTransforms.AppendElement();
+  nsSVGTransform* transform = mTransforms.AppendElement(fallible);
   if (!transform) {
     return false;
   }
   transform->SetSkewY(skew);
 
   return true;
 }
 
@@ -258,16 +258,16 @@ SVGTransformListParser::ParseMatrix()
 {
   float m[6];
   uint32_t count;
 
   if (!ParseArguments(m, ArrayLength(m), &count) || count != 6) {
     return false;
   }
 
-  nsSVGTransform* transform = mTransforms.AppendElement();
+  nsSVGTransform* transform = mTransforms.AppendElement(fallible);
   if (!transform) {
     return false;
   }
   transform->SetMatrix(gfxMatrix(m[0], m[1], m[2], m[3], m[4], m[5]));
 
   return true;
 }
--- a/dom/svg/SVGTransformListSMILType.cpp
+++ b/dom/svg/SVGTransformListSMILType.cpp
@@ -113,17 +113,17 @@ SVGTransformListSMILType::Add(nsSMILValu
   // nsSMILValue with an empty transform array.)
   NS_ASSERTION(dstTransforms.Length() < 2,
     "Invalid dest transform list to add to");
 
   // Get the individual transforms to add
   const SVGTransformSMILData& srcTransform = srcTransforms[0];
   if (dstTransforms.IsEmpty()) {
     SVGTransformSMILData* result = dstTransforms.AppendElement(
-      SVGTransformSMILData(srcTransform.mTransformType));
+      SVGTransformSMILData(srcTransform.mTransformType), fallible);
     NS_ENSURE_TRUE(result,NS_ERROR_OUT_OF_MEMORY);
   }
   SVGTransformSMILData& dstTransform = dstTransforms[0];
 
   // The types must be the same
   NS_ASSERTION(srcTransform.mTransformType == dstTransform.mTransformType,
     "Trying to perform simple add of different transform types");
 
@@ -165,17 +165,18 @@ SVGTransformListSMILType::SandwichAdd(ns
   // first value) and instead attempt to add that empty value to the underlying
   // value.
   // In any case, the expected result is that nothing is added.
   if (srcTransforms.IsEmpty())
     return NS_OK;
 
   // Stick the src on the end of the array
   const SVGTransformSMILData& srcTransform = srcTransforms[0];
-  SVGTransformSMILData* result = dstTransforms.AppendElement(srcTransform);
+  SVGTransformSMILData* result =
+    dstTransforms.AppendElement(srcTransform, fallible);
   NS_ENSURE_TRUE(result,NS_ERROR_OUT_OF_MEMORY);
 
   return NS_OK;
 }
 
 nsresult
 SVGTransformListSMILType::ComputeDistance(const nsSMILValue& aFrom,
                                           const nsSMILValue& aTo,
@@ -300,17 +301,17 @@ SVGTransformListSMILType::Interpolate(co
 
   // Clear the way for it in the result array
   TransformArray& dstTransforms =
     (*static_cast<TransformArray*>(aResult.mU.mPtr));
   dstTransforms.Clear();
 
   // Assign the result
   SVGTransformSMILData* transform =
-    dstTransforms.AppendElement(resultTransform);
+    dstTransforms.AppendElement(resultTransform, fallible);
   NS_ENSURE_TRUE(transform,NS_ERROR_OUT_OF_MEMORY);
 
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
 // Transform array accessors
 
@@ -318,17 +319,17 @@ SVGTransformListSMILType::Interpolate(co
 nsresult
 SVGTransformListSMILType::AppendTransform(
   const SVGTransformSMILData& aTransform,
   nsSMILValue& aValue)
 {
   NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
 
   TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
-  return transforms.AppendElement(aTransform) ?
+  return transforms.AppendElement(aTransform, fallible) ?
     NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 // static
 bool
 SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList,
                                            nsSMILValue& aValue)
 {
@@ -337,17 +338,18 @@ SVGTransformListSMILType::AppendTransfor
   TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
 
   if (!transforms.SetCapacity(transforms.Length() + aList.Length(), fallible))
     return false;
 
   for (uint32_t i = 0; i < aList.Length(); ++i) {
     // No need to check the return value below since we have already allocated
     // the necessary space
-    MOZ_ALWAYS_TRUE(transforms.AppendElement(SVGTransformSMILData(aList[i])));
+    MOZ_ALWAYS_TRUE(transforms.AppendElement(SVGTransformSMILData(aList[i]),
+                                             fallible));
   }
   return true;
 }
 
 // static
 bool
 SVGTransformListSMILType::GetTransforms(const nsSMILValue& aValue,
                                         FallibleTArray<nsSVGTransform>& aTransforms)
@@ -359,12 +361,12 @@ SVGTransformListSMILType::GetTransforms(
 
   aTransforms.Clear();
   if (!aTransforms.SetCapacity(smilTransforms.Length(), fallible))
       return false;
 
   for (uint32_t i = 0; i < smilTransforms.Length(); ++i) {
     // No need to check the return value below since we have already allocated
     // the necessary space
-    aTransforms.AppendElement(smilTransforms[i].ToSVGTransform());
+    aTransforms.AppendElement(smilTransforms[i].ToSVGTransform(), fallible);
   }
   return true;
 }
--- a/dom/tv/TVSource.cpp
+++ b/dom/tv/TVSource.cpp
@@ -344,17 +344,17 @@ TVSource::NotifyEITBroadcasted(nsITVChan
                                nsITVProgramData** aProgramDataList,
                                uint32_t aCount)
 {
   nsRefPtr<TVChannel> channel = TVChannel::Create(GetOwner(), this, aChannelData);
   Sequence<OwningNonNull<TVProgram>> programs;
   for (uint32_t i = 0; i < aCount; i++) {
     nsRefPtr<TVProgram> program =
       new TVProgram(GetOwner(), channel, aProgramDataList[i]);
-    *programs.AppendElement() = program;
+    *programs.AppendElement(fallible) = program;
   }
   return DispatchEITBroadcastedEvent(programs);
 }
 
 nsresult
 TVSource::DispatchCurrentChannelChangedEvent(TVChannel* aChannel)
 {
   TVCurrentChannelChangedEventInit init;
--- a/gfx/layers/apz/testutil/APZTestData.cpp
+++ b/gfx/layers/apz/testutil/APZTestData.cpp
@@ -12,17 +12,17 @@ namespace mozilla {
 namespace layers {
 
 struct APZTestDataToJSConverter {
   template <typename Key, typename Value, typename KeyValuePair>
   static void ConvertMap(const std::map<Key, Value>& aFrom,
                                dom::Sequence<KeyValuePair>& aOutTo,
                                void (*aElementConverter)(const Key&, const Value&, KeyValuePair&)) {
     for (auto it = aFrom.begin(); it != aFrom.end(); ++it) {
-      aOutTo.AppendElement();
+      aOutTo.AppendElement(fallible);
       aElementConverter(it->first, it->second, aOutTo.LastElement());
     }
   }
 
   static void ConvertAPZTestData(const APZTestData& aFrom,
                                  dom::APZTestData& aOutTo) {
     ConvertMap(aFrom.mPaints, aOutTo.mPaints.Construct(), ConvertBucket);
     ConvertMap(aFrom.mRepaintRequests, aOutTo.mRepaintRequests.Construct(), ConvertBucket);
--- a/image/SourceBuffer.cpp
+++ b/image/SourceBuffer.cpp
@@ -73,17 +73,17 @@ SourceBuffer::AppendChunk(Maybe<Chunk>&&
   if (MOZ_UNLIKELY(!aChunk)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   if (MOZ_UNLIKELY(aChunk->AllocationFailed())) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
-  if (MOZ_UNLIKELY(!mChunks.AppendElement(Move(*aChunk)))) {
+  if (MOZ_UNLIKELY(!mChunks.AppendElement(Move(*aChunk), fallible))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
 
 Maybe<SourceBuffer::Chunk>
 SourceBuffer::CreateChunk(size_t aCapacity, bool aRoundUp /* = true */)
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -521,17 +521,17 @@ struct ParamTraits<FallibleTArray<E> >
 
       memcpy(elements, outdata, pickledLength);
     } else {
       if (!aResult->SetCapacity(length, mozilla::fallible)) {
         return false;
       }
 
       for (uint32_t index = 0; index < length; index++) {
-        E* element = aResult->AppendElement();
+        E* element = aResult->AppendElement(mozilla::fallible);
         MOZ_ASSERT(element);
         if (!ReadParam(aMsg, aIter, element)) {
           return false;
         }
       }
     }
 
     return true;
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -5165,17 +5165,17 @@ public:
   {
     nsIntRegionRectIterator it(mRegion);
     while (const nsIntRect* iterRect = it.Next()) {
       mozilla::dom::ProfileTimelineLayerRect rect;
       rect.mX = iterRect->X();
       rect.mY = iterRect->Y();
       rect.mWidth = iterRect->Width();
       rect.mHeight = iterRect->Height();
-      aRectangles.AppendElement(rect);
+      aRectangles.AppendElement(rect, fallible);
     }
   }
 
 private:
   nsIntRegion mRegion;
 };
 
 /*
--- a/layout/base/SelectionCarets.cpp
+++ b/layout/base/SelectionCarets.cpp
@@ -1026,35 +1026,35 @@ SelectionCarets::GetFrameSelection()
   }
 }
 
 static dom::Sequence<SelectionState>
 GetSelectionStates(int16_t aReason)
 {
   dom::Sequence<SelectionState> states;
   if (aReason & nsISelectionListener::DRAG_REASON) {
-    states.AppendElement(SelectionState::Drag);
+    states.AppendElement(SelectionState::Drag, fallible);
   }
   if (aReason & nsISelectionListener::MOUSEDOWN_REASON) {
-    states.AppendElement(SelectionState::Mousedown);
+    states.AppendElement(SelectionState::Mousedown, fallible);
   }
   if (aReason & nsISelectionListener::MOUSEUP_REASON) {
-    states.AppendElement(SelectionState::Mouseup);
+    states.AppendElement(SelectionState::Mouseup, fallible);
   }
   if (aReason & nsISelectionListener::KEYPRESS_REASON) {
-    states.AppendElement(SelectionState::Keypress);
+    states.AppendElement(SelectionState::Keypress, fallible);
   }
   if (aReason & nsISelectionListener::SELECTALL_REASON) {
-    states.AppendElement(SelectionState::Selectall);
+    states.AppendElement(SelectionState::Selectall, fallible);
   }
   if (aReason & nsISelectionListener::COLLAPSETOSTART_REASON) {
-    states.AppendElement(SelectionState::Collapsetostart);
+    states.AppendElement(SelectionState::Collapsetostart, fallible);
   }
   if (aReason & nsISelectionListener::COLLAPSETOEND_REASON) {
-    states.AppendElement(SelectionState::Collapsetoend);
+    states.AppendElement(SelectionState::Collapsetoend, fallible);
   }
   return states;
 }
 
 void
 SelectionCarets::DispatchCustomEvent(const nsAString& aEvent)
 {
   SELECTIONCARETS_LOG("dispatch %s event", NS_ConvertUTF16toUTF8(aEvent).get());
@@ -1069,17 +1069,17 @@ SelectionCarets::DispatchCustomEvent(con
                                        &defaultActionEnabled);
 }
 
 void
 SelectionCarets::DispatchSelectionStateChangedEvent(Selection* aSelection,
                                                     SelectionState aState)
 {
   dom::Sequence<SelectionState> state;
-  state.AppendElement(aState);
+  state.AppendElement(aState, fallible);
   DispatchSelectionStateChangedEvent(aSelection, state);
 }
 
 void
 SelectionCarets::DispatchSelectionStateChangedEvent(Selection* aSelection,
                                                     const Sequence<SelectionState>& aStates)
 {
   nsIDocument* doc = mPresShell->GetDocument();
--- a/layout/base/TouchCaret.cpp
+++ b/layout/base/TouchCaret.cpp
@@ -1144,17 +1144,17 @@ TouchCaret::DispatchTapEvent()
 
   domRect->SetLayoutRect(rect);
   init.mBoundingClientRect = domRect;
   init.mVisible = false;
 
   sel->Stringify(init.mSelectedText);
 
   dom::Sequence<dom::SelectionState> state;
-  state.AppendElement(dom::SelectionState::Taponcaret);
+  state.AppendElement(dom::SelectionState::Taponcaret, fallible);
   init.mStates = state;
 
   nsRefPtr<dom::SelectionStateChangedEvent> event =
     dom::SelectionStateChangedEvent::Constructor(doc, NS_LITERAL_STRING("mozselectionstatechanged"), init);
 
   event->SetTrusted(true);
   event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
   bool ret;
--- a/layout/style/MediaQueryList.cpp
+++ b/layout/style/MediaQueryList.cpp
@@ -98,17 +98,17 @@ MediaQueryList::AddListener(MediaQueryLi
 
   for (uint32_t i = 0; i < mCallbacks.Length(); ++i) {
     if (aListener == *mCallbacks[i]) {
       // Already registered
       return;
     }
   }
 
-  mCallbacks.AppendElement(&aListener);
+  mCallbacks.AppendElement(&aListener, fallible);
   if (!HasListeners()) {
     // Append failed; undo the AddRef above.
     NS_RELEASE_THIS();
   }
 }
 
 void
 MediaQueryList::RemoveListener(MediaQueryListListener& aListener)
@@ -174,17 +174,17 @@ MediaQueryList::MediumFeaturesChanged(No
 {
   mMatchesValid = false;
 
   if (HasListeners()) {
     bool oldMatches = mMatches;
     RecomputeMatches();
     if (mMatches != oldMatches) {
       for (uint32_t i = 0, i_end = mCallbacks.Length(); i != i_end; ++i) {
-        HandleChangeData *d = aListenersToNotify.AppendElement();
+        HandleChangeData *d = aListenersToNotify.AppendElement(fallible);
         if (d) {
           d->mql = this;
           d->callback = mCallbacks[i];
         }
       }
     }
   }
 }
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2932,17 +2932,17 @@ static void ToRTCIceCandidateStats(
         NS_ConvertASCIItoUTF16(c->cand_addr.host.c_str()));
     cand.mPortNumber.Construct(c->cand_addr.port);
     cand.mTransport.Construct(
         NS_ConvertASCIItoUTF16(c->cand_addr.transport.c_str()));
     if (candidateType == RTCStatsType::Localcandidate) {
       cand.mMozLocalTransport.Construct(
           NS_ConvertASCIItoUTF16(c->local_addr.transport.c_str()));
     }
-    report->mIceCandidateStats.Value().AppendElement(cand);
+    report->mIceCandidateStats.Value().AppendElement(cand, fallible);
   }
 }
 
 static void RecordIceStats_s(
     NrIceMediaStream& mediaStream,
     bool internalStats,
     DOMHighResTimeStamp now,
     RTCStatsReportInternal* report) {
@@ -2969,17 +2969,17 @@ static void RecordIceStats_s(
     s.mTimestamp.Construct(now);
     s.mType.Construct(RTCStatsType::Candidatepair);
     s.mLocalCandidateId.Construct(localCodeword);
     s.mRemoteCandidateId.Construct(remoteCodeword);
     s.mNominated.Construct(p->nominated);
     s.mMozPriority.Construct(p->priority);
     s.mSelected.Construct(p->selected);
     s.mState.Construct(RTCStatsIceCandidatePairState(p->state));
-    report->mIceCandidatePairStats.Value().AppendElement(s);
+    report->mIceCandidatePairStats.Value().AppendElement(s, fallible);
   }
 
   std::vector<NrIceCandidate> candidates;
   if (NS_SUCCEEDED(mediaStream.GetLocalCandidates(&candidates))) {
     ToRTCIceCandidateStats(candidates,
                            RTCStatsType::Localcandidate,
                            componentId,
                            now,
@@ -3048,17 +3048,18 @@ PeerConnectionImpl::ExecuteStatsQuery_s(
             s.mMediaType.Construct(mediaType);
             s.mJitter.Construct(double(jitterMs)/1000);
             s.mRemoteId.Construct(localId);
             s.mIsRemote = true;
             s.mPacketsReceived.Construct(packetsReceived);
             s.mBytesReceived.Construct(bytesReceived);
             s.mPacketsLost.Construct(packetsLost);
             s.mMozRtt.Construct(rtt);
-            query->report->mInboundRTPStreamStats.Value().AppendElement(s);
+            query->report->mInboundRTPStreamStats.Value().AppendElement(s,
+                                                                        fallible);
           }
         }
         // Then, fill in local side (with cross-link to remote only if present)
         {
           RTCOutboundRTPStreamStats s;
           s.mTimestamp.Construct(query->now);
           s.mId.Construct(localId);
           s.mType.Construct(RTCStatsType::Outboundrtp);
@@ -3085,17 +3086,18 @@ PeerConnectionImpl::ExecuteStatsQuery_s(
                                                    &droppedFrames)) {
               s.mFramerateMean.Construct(framerateMean);
               s.mFramerateStdDev.Construct(framerateStdDev);
               s.mBitrateMean.Construct(bitrateMean);
               s.mBitrateStdDev.Construct(bitrateStdDev);
               s.mDroppedFrames.Construct(droppedFrames);
             }
           }
-          query->report->mOutboundRTPStreamStats.Value().AppendElement(s);
+          query->report->mOutboundRTPStreamStats.Value().AppendElement(s,
+                                                                       fallible);
         }
         break;
       }
       case MediaPipeline::RECEIVE: {
         nsString localId = NS_LITERAL_STRING("inbound_rtp_") + idstr;
         nsString remoteId;
         nsString ssrc;
         unsigned int ssrcval;
@@ -3117,17 +3119,18 @@ PeerConnectionImpl::ExecuteStatsQuery_s(
             if (ssrc.Length()) {
               s.mSsrc.Construct(ssrc);
             }
             s.mMediaType.Construct(mediaType);
             s.mRemoteId.Construct(localId);
             s.mIsRemote = true;
             s.mPacketsSent.Construct(packetsSent);
             s.mBytesSent.Construct(bytesSent);
-            query->report->mOutboundRTPStreamStats.Value().AppendElement(s);
+            query->report->mOutboundRTPStreamStats.Value().AppendElement(s,
+                                                                         fallible);
           }
         }
         // Then, fill in local side (with cross-link to remote only if present)
         RTCInboundRTPStreamStats s;
         s.mTimestamp.Construct(query->now);
         s.mId.Construct(localId);
         s.mType.Construct(RTCStatsType::Inboundrtp);
         if (ssrc.Length()) {
@@ -3171,17 +3174,18 @@ PeerConnectionImpl::ExecuteStatsQuery_s(
                                                  &discardedPackets)) {
             s.mFramerateMean.Construct(framerateMean);
             s.mFramerateStdDev.Construct(framerateStdDev);
             s.mBitrateMean.Construct(bitrateMean);
             s.mBitrateStdDev.Construct(bitrateStdDev);
             s.mDiscardedPackets.Construct(discardedPackets);
           }
         }
-        query->report->mInboundRTPStreamStats.Value().AppendElement(s);
+        query->report->mInboundRTPStreamStats.Value().AppendElement(s,
+                                                                    fallible);
         break;
       }
     }
 
     if (!query->grabAllLevels) {
       // If we're grabbing all levels, that means we want datachannels too,
       // which don't have pipelines.
       if (query->iceCtx->GetStream(p)) {
--- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
+++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp
@@ -266,24 +266,24 @@ OnStatsReport_m(WebrtcGlobalChild* aThis
   StatsRequest* request = StatsRequest::Get(aRequestId);
 
   if (!request) {
     CSFLogError(logTag, "Bad RequestId");
     return;
   }
 
   for (auto&& query : *aQueryList) {
-    request->mResult.mReports.Value().AppendElement(*(query->report));
+    request->mResult.mReports.Value().AppendElement(*(query->report), fallible);
   }
 
   // Reports saved for closed/destroyed PeerConnections
   auto ctx = PeerConnectionCtx::GetInstance();
   if (ctx) {
     for (auto&& pc : ctx->mStatsForClosedPeerConnections) {
-      request->mResult.mReports.Value().AppendElement(pc);
+      request->mResult.mReports.Value().AppendElement(pc, fallible);
     }
   }
 
   request->Complete();
   StatsRequest::Delete(aRequestId);
 }
 
 static void
@@ -317,19 +317,19 @@ static void OnGetLogging_m(WebrtcGlobalC
 
   if (aThisChild) {
     // Add this log to the collection of logs and call into
     // the next content process.
     Sequence<nsString> nsLogs;
 
     if (!aLogList->empty()) {
       for (auto& line : *aLogList) {
-        nsLogs.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()));
+        nsLogs.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()), fallible);
       }
-      nsLogs.AppendElement(NS_LITERAL_STRING("+++++++ END ++++++++"));
+      nsLogs.AppendElement(NS_LITERAL_STRING("+++++++ END ++++++++"), fallible);
     }
 
     unused << aThisChild->SendGetLogResult(aRequestId, nsLogs);
     return;
   }
 
   // This is the last log to be collected. (Must be the gecko process).
   MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
@@ -338,19 +338,21 @@ static void OnGetLogging_m(WebrtcGlobalC
 
   if (!request) {
     CSFLogError(logTag, "Bad RequestId");
     return;
   }
 
   if (!aLogList->empty()) {
     for (auto& line : *aLogList) {
-      request->mResult.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()));
+      request->mResult.AppendElement(NS_ConvertUTF8toUTF16(line.c_str()),
+                                     fallible);
     }
-    request->mResult.AppendElement(NS_LITERAL_STRING("+++++++ END ++++++++"));
+    request->mResult.AppendElement(NS_LITERAL_STRING("+++++++ END ++++++++"),
+                                   fallible);
   }
 
   request->Complete();
   LogRequest::Delete(aRequestId);
 }
 
 static void GetLogging_s(WebrtcGlobalChild* aThisChild,
                          const int aRequestId,
@@ -621,17 +623,17 @@ WebrtcGlobalParent::RecvGetStatsResult(c
   StatsRequest* request = StatsRequest::Get(aRequestId);
 
   if (!request) {
     CSFLogError(logTag, "Bad RequestId");
     return false;
   }
 
   for (auto&& s : Stats) {
-    request->mResult.mReports.Value().AppendElement(s);
+    request->mResult.mReports.Value().AppendElement(s, fallible);
   }
 
   auto next = request->GetNextParent();
   if (next) {
     // There are more content instances to query.
     return next->SendGetStatsRequest(request->mRequestId, request->mPcIdFilter);
   }
 
@@ -1000,17 +1002,17 @@ static void StoreLongTermICEStatisticsIm
       }
     }
   }
 
   // Finally, store the stats
 
   PeerConnectionCtx *ctx = GetPeerConnectionCtx();
   if (ctx) {
-    ctx->mStatsForClosedPeerConnections.AppendElement(*query->report);
+    ctx->mStatsForClosedPeerConnections.AppendElement(*query->report, fallible);
   }
 }
 
 static void GetStatsForLongTermStorage_s(
     nsAutoPtr<RTCStatsQuery> query) {
 
   MOZ_ASSERT(query);
 
--- a/netwerk/base/Dashboard.cpp
+++ b/netwerk/base/Dashboard.cpp
@@ -306,17 +306,17 @@ LookupHelper::ConstructAnswer(LookupArgu
 
     Sequence<nsString> &addresses = dict.mAddress.Value();
 
     if (NS_SUCCEEDED(mStatus)) {
         dict.mAnswer = true;
         bool hasMore;
         aRecord->HasMore(&hasMore);
         while (hasMore) {
-            nsString* nextAddress = addresses.AppendElement();
+            nsString* nextAddress = addresses.AppendElement(fallible);
             if (!nextAddress) {
                 return NS_ERROR_OUT_OF_MEMORY;
             }
 
             nsCString nextAddressASCII;
             aRecord->GetNextAddrAsString(nextAddressASCII);
             CopyASCIItoUTF16(nextAddressASCII, *nextAddress);
             aRecord->HasMore(&hasMore);
@@ -392,17 +392,17 @@ Dashboard::GetSockets(SocketData *aSocke
 
     uint32_t length = socketData->mData.Length();
     if (!sockets.SetCapacity(length, fallible)) {
             JS_ReportOutOfMemory(cx);
             return NS_ERROR_OUT_OF_MEMORY;
     }
 
     for (uint32_t i = 0; i < socketData->mData.Length(); i++) {
-        mozilla::dom::SocketElement &mSocket = *sockets.AppendElement();
+        dom::SocketElement &mSocket = *sockets.AppendElement(fallible);
         CopyASCIItoUTF16(socketData->mData[i].host, mSocket.mHost);
         mSocket.mPort = socketData->mData[i].port;
         mSocket.mActive = socketData->mData[i].active;
         mSocket.mTcp = socketData->mData[i].tcp;
         mSocket.mSent = (double) socketData->mData[i].sent;
         mSocket.mReceived = (double) socketData->mData[i].received;
         dict.mSent += socketData->mData[i].sent;
         dict.mReceived += socketData->mData[i].received;
@@ -462,17 +462,17 @@ Dashboard::GetHttpConnections(HttpData *
 
     uint32_t length = httpData->mData.Length();
     if (!connections.SetCapacity(length, fallible)) {
             JS_ReportOutOfMemory(cx);
             return NS_ERROR_OUT_OF_MEMORY;
     }
 
     for (uint32_t i = 0; i < httpData->mData.Length(); i++) {
-        HttpConnectionElement &connection = *connections.AppendElement();
+        HttpConnectionElement &connection = *connections.AppendElement(fallible);
 
         CopyASCIItoUTF16(httpData->mData[i].host, connection.mHost);
         connection.mPort = httpData->mData[i].port;
         connection.mSpdy = httpData->mData[i].spdy;
         connection.mSsl = httpData->mData[i].ssl;
 
         connection.mActive.Construct();
         connection.mIdle.Construct();
@@ -486,32 +486,32 @@ Dashboard::GetHttpConnections(HttpData *
             !idle.SetCapacity(httpData->mData[i].idle.Length(), fallible) ||
             !halfOpens.SetCapacity(httpData->mData[i].halfOpens.Length(),
                                    fallible)) {
                 JS_ReportOutOfMemory(cx);
                 return NS_ERROR_OUT_OF_MEMORY;
         }
 
         for (uint32_t j = 0; j < httpData->mData[i].active.Length(); j++) {
-            HttpConnInfo &info = *active.AppendElement();
+            HttpConnInfo &info = *active.AppendElement(fallible);
             info.mRtt = httpData->mData[i].active[j].rtt;
             info.mTtl = httpData->mData[i].active[j].ttl;
             info.mProtocolVersion =
                 httpData->mData[i].active[j].protocolVersion;
         }
 
         for (uint32_t j = 0; j < httpData->mData[i].idle.Length(); j++) {
-            HttpConnInfo &info = *idle.AppendElement();
+            HttpConnInfo &info = *idle.AppendElement(fallible);
             info.mRtt = httpData->mData[i].idle[j].rtt;
             info.mTtl = httpData->mData[i].idle[j].ttl;
             info.mProtocolVersion = httpData->mData[i].idle[j].protocolVersion;
         }
 
         for (uint32_t j = 0; j < httpData->mData[i].halfOpens.Length(); j++) {
-            HalfOpenInfoDict &info = *halfOpens.AppendElement();
+            HalfOpenInfoDict &info = *halfOpens.AppendElement(fallible);
             info.mSpeculative = httpData->mData[i].halfOpens[j].speculative;
         }
     }
 
     JS::RootedValue val(cx);
     if (!ToJSValue(cx, dict, &val)) {
         return NS_ERROR_FAILURE;
     }
@@ -625,17 +625,17 @@ Dashboard::GetWebSocketConnections(WebSo
     mozilla::MutexAutoLock lock(mWs.lock);
     uint32_t length = mWs.data.Length();
     if (!websockets.SetCapacity(length, fallible)) {
         JS_ReportOutOfMemory(cx);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     for (uint32_t i = 0; i < mWs.data.Length(); i++) {
-        mozilla::dom::WebSocketElement &websocket = *websockets.AppendElement();
+        dom::WebSocketElement &websocket = *websockets.AppendElement(fallible);
         CopyASCIItoUTF16(mWs.data[i].mHost, websocket.mHostport);
         websocket.mMsgsent = mWs.data[i].mMsgSent;
         websocket.mMsgreceived = mWs.data[i].mMsgReceived;
         websocket.mSentsize = mWs.data[i].mSizeSent;
         websocket.mReceivedsize = mWs.data[i].mSizeReceived;
         websocket.mEncrypted = mWs.data[i].mEncrypted;
     }
 
@@ -698,31 +698,31 @@ Dashboard::GetDNSCacheEntries(DnsData *d
 
     uint32_t length = dnsData->mData.Length();
     if (!entries.SetCapacity(length, fallible)) {
         JS_ReportOutOfMemory(cx);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     for (uint32_t i = 0; i < dnsData->mData.Length(); i++) {
-        mozilla::dom::DnsCacheEntry &entry = *entries.AppendElement();
+        dom::DnsCacheEntry &entry = *entries.AppendElement(fallible);
         entry.mHostaddr.Construct();
 
         Sequence<nsString> &addrs = entry.mHostaddr.Value();
         if (!addrs.SetCapacity(dnsData->mData[i].hostaddr.Length(), fallible)) {
             JS_ReportOutOfMemory(cx);
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
         CopyASCIItoUTF16(dnsData->mData[i].hostname, entry.mHostname);
         entry.mExpiration = dnsData->mData[i].expiration;
 
         for (uint32_t j = 0; j < dnsData->mData[i].hostaddr.Length(); j++) {
             CopyASCIItoUTF16(dnsData->mData[i].hostaddr[j],
-                *addrs.AppendElement());
+                             *addrs.AppendElement(fallible));
         }
 
         if (dnsData->mData[i].family == PR_AF_INET6) {
             CopyASCIItoUTF16("ipv6", entry.mFamily);
         } else {
             CopyASCIItoUTF16("ipv4", entry.mFamily);
         }
     }
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -116,48 +116,48 @@ namespace mozilla {
 namespace safebrowsing {
 
 const uint32_t STORE_MAGIC = 0x1231af3b;
 const uint32_t CURRENT_VERSION = 3;
 
 nsresult
 TableUpdate::NewAddPrefix(uint32_t aAddChunk, const Prefix& aHash)
 {
-  AddPrefix *add = mAddPrefixes.AppendElement();
+  AddPrefix *add = mAddPrefixes.AppendElement(fallible);
   if (!add) return NS_ERROR_OUT_OF_MEMORY;
   add->addChunk = aAddChunk;
   add->prefix = aHash;
   return NS_OK;
 }
 
 nsresult
 TableUpdate::NewSubPrefix(uint32_t aAddChunk, const Prefix& aHash, uint32_t aSubChunk)
 {
-  SubPrefix *sub = mSubPrefixes.AppendElement();
+  SubPrefix *sub = mSubPrefixes.AppendElement(fallible);
   if (!sub) return NS_ERROR_OUT_OF_MEMORY;
   sub->addChunk = aAddChunk;
   sub->prefix = aHash;
   sub->subChunk = aSubChunk;
   return NS_OK;
 }
 
 nsresult
 TableUpdate::NewAddComplete(uint32_t aAddChunk, const Completion& aHash)
 {
-  AddComplete *add = mAddCompletes.AppendElement();
+  AddComplete *add = mAddCompletes.AppendElement(fallible);
   if (!add) return NS_ERROR_OUT_OF_MEMORY;
   add->addChunk = aAddChunk;
   add->complete = aHash;
   return NS_OK;
 }
 
 nsresult
 TableUpdate::NewSubComplete(uint32_t aAddChunk, const Completion& aHash, uint32_t aSubChunk)
 {
-  SubComplete *sub = mSubCompletes.AppendElement();
+  SubComplete *sub = mSubCompletes.AppendElement(fallible);
   if (!sub) return NS_ERROR_OUT_OF_MEMORY;
   sub->addChunk = aAddChunk;
   sub->complete = aHash;
   sub->subChunk = aSubChunk;
   return NS_OK;
 }
 
 HashStore::HashStore(const nsACString& aTableName, nsIFile* aStoreDir)
@@ -704,18 +704,21 @@ ByteSliceRead(nsIInputStream* aInStream,
   rv = ReadTArray(aInStream, &slice4, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aData->SetCapacity(count, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   for (uint32_t i = 0; i < count; i++) {
-    aData->AppendElement((slice1[i] << 24) | (slice2[i] << 16)
-                         | (slice3[i] << 8) | (slice4[i]));
+    aData->AppendElement((slice1[i] << 24) |
+                           (slice2[i] << 16) |
+                           (slice3[i] << 8) |
+                           (slice4[i]),
+                         fallible);
   }
 
   return NS_OK;
 }
 
 nsresult
 HashStore::ReadAddPrefixes()
 {
@@ -724,17 +727,17 @@ HashStore::ReadAddPrefixes()
 
   nsresult rv = ByteSliceRead(mInputStream, &chunks, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mAddPrefixes.SetCapacity(count, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   for (uint32_t i = 0; i < count; i++) {
-    AddPrefix *add = mAddPrefixes.AppendElement();
+    AddPrefix *add = mAddPrefixes.AppendElement(fallible);
     add->prefix.FromUint32(0);
     add->addChunk = chunks[i];
   }
 
   return NS_OK;
 }
 
 nsresult
@@ -753,17 +756,17 @@ HashStore::ReadSubPrefixes()
 
   rv = ByteSliceRead(mInputStream, &prefixes, count);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mSubPrefixes.SetCapacity(count, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   for (uint32_t i = 0; i < count; i++) {
-    SubPrefix *sub = mSubPrefixes.AppendElement();
+    SubPrefix *sub = mSubPrefixes.AppendElement(fallible);
     sub->addChunk = addchunks[i];
     sub->prefix.FromUint32(prefixes[i]);
     sub->subChunk = subchunks[i];
   }
 
   return NS_OK;
 }