Bug 968520 - Add mozilla::fallible to Fallible{Auto,}TArray::SetLength calls. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 18 May 2015 13:50:35 -0700
changeset 244452 5bf8a0b4add02c66253a83267e8b875b8ccb991c
parent 244451 e1cd799bafd474d7d7f92f7380ceefd270ed2a72
child 244453 8e8c7edadef60ae945ffb436ac6ec272eff3f884
push id28781
push usercbook@mozilla.com
push dateTue, 19 May 2015 10:01:15 +0000
treeherdermozilla-central@4fb7ff694bf5 [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 Fallible{Auto,}TArray::SetLength calls. r=froydnj
dom/canvas/WebGLElementArrayCache.cpp
dom/crypto/WebCryptoCommon.h
dom/crypto/WebCryptoTask.cpp
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/ipc/Blob.cpp
dom/media/MediaData.cpp
dom/media/fmp4/MP4Demuxer.cpp
dom/media/mediasource/ContainerParser.cpp
dom/media/webaudio/AudioDestinationNode.cpp
dom/media/webaudio/DelayBuffer.cpp
dom/media/webaudio/MediaBufferDecoder.cpp
dom/mobilemessage/MobileMessageManager.cpp
dom/plugins/ipc/PluginScriptableObjectChild.cpp
dom/plugins/ipc/PluginScriptableObjectParent.cpp
dom/svg/DOMSVGLengthList.cpp
dom/svg/DOMSVGNumberList.cpp
dom/svg/DOMSVGPointList.cpp
dom/svg/DOMSVGTransformList.cpp
dom/svg/SVGLengthList.h
dom/svg/SVGNumberList.h
dom/svg/SVGPathData.cpp
dom/svg/SVGPathData.h
dom/svg/SVGPointList.h
dom/svg/SVGStringList.h
dom/svg/SVGTransformList.h
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxCoreTextShaper.cpp
gfx/thebes/gfxGraphiteShaper.cpp
gfx/thebes/gfxHarfBuzzShaper.cpp
gfx/thebes/gfxUserFontSet.cpp
intl/hyphenation/nsHyphenator.cpp
ipc/ipdl/ipdl/lower.py
layout/svg/nsSVGUtils.cpp
media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
media/libstagefright/frameworks/av/media/libstagefright/MediaBuffer.cpp
toolkit/components/url-classifier/ChunkSet.cpp
toolkit/components/url-classifier/Entries.h
toolkit/components/url-classifier/HashStore.cpp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
--- a/dom/canvas/WebGLElementArrayCache.cpp
+++ b/dom/canvas/WebGLElementArrayCache.cpp
@@ -371,17 +371,17 @@ WebGLElementArrayCacheTree<T>::Update(si
         size_t numLeavesNonPOT = (numberOfElements + kElementsPerLeaf - 1) / kElementsPerLeaf;
         // It only remains to round that up to the next power of two:
         requiredNumLeaves = RoundUpPow2(numLeavesNonPOT);
     }
 
     // Step #0: If needed, resize our tree data storage.
     if (requiredNumLeaves != NumLeaves()) {
         // See class comment for why we the tree storage size is 2 * numLeaves.
-        if (!mTreeData.SetLength(2 * requiredNumLeaves)) {
+        if (!mTreeData.SetLength(2 * requiredNumLeaves, fallible)) {
             mTreeData.SetLength(0);
             return false;
         }
         MOZ_ASSERT(NumLeaves() == requiredNumLeaves);
 
         if (NumLeaves()) {
             // When resizing, update the whole tree, not just the subset
             // corresponding to the part of the buffer being updated.
@@ -465,17 +465,17 @@ WebGLElementArrayCache::WebGLElementArra
 WebGLElementArrayCache::~WebGLElementArrayCache()
 {
 }
 
 bool
 WebGLElementArrayCache::BufferData(const void* ptr, size_t byteLength)
 {
     if (mBytes.Length() != byteLength) {
-        if (!mBytes.SetLength(byteLength)) {
+        if (!mBytes.SetLength(byteLength, fallible)) {
             mBytes.SetLength(0);
             return false;
         }
     }
     MOZ_ASSERT(mBytes.Length() == byteLength);
     return BufferSubData(0, ptr, byteLength);
 }
 
--- a/dom/crypto/WebCryptoCommon.h
+++ b/dom/crypto/WebCryptoCommon.h
@@ -147,17 +147,17 @@ ReadBuffer(JSStructuredCloneReader* aRea
 {
   uint32_t length, zero;
   bool ret = JS_ReadUint32Pair(aReader, &length, &zero);
   if (!ret) {
     return false;
   }
 
   if (length > 0) {
-    if (!aBuffer.SetLength(length)) {
+    if (!aBuffer.SetLength(length, fallible)) {
       return false;
     }
     ret = JS_ReadBytes(aReader, aBuffer.Elements(), aBuffer.Length());
   }
   return ret;
 }
 
 inline bool
--- a/dom/crypto/WebCryptoTask.cpp
+++ b/dom/crypto/WebCryptoTask.cpp
@@ -550,17 +550,17 @@ private:
                                               CKA_ENCRYPT, &keyItem, nullptr));
     if (!symKey) {
       return NS_ERROR_DOM_INVALID_ACCESS_ERR;
     }
 
     // Initialize the output buffer (enough space for padding / a full tag)
     uint32_t dataLen = mData.Length();
     uint32_t maxLen = dataLen + 16;
-    if (!mResult.SetLength(maxLen)) {
+    if (!mResult.SetLength(maxLen, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
     uint32_t outLen = 0;
 
     // Perform the encryption/decryption
     if (mEncrypt) {
       rv = MapSECStatus(PK11_Encrypt(symKey.get(), mMechanism, &param,
                                      mResult.Elements(), &outLen, maxLen,
@@ -674,17 +674,17 @@ private:
                                                    PK11_OriginUnwrap, fakeOperation,
                                                    &dataItem, nullptr));
       if (!keyToWrap) {
         return NS_ERROR_DOM_OPERATION_ERR;
       }
 
       // Encrypt and return the wrapped key
       // AES-KW encryption results in a wrapped key 64 bits longer
-      if (!mResult.SetLength(mData.Length() + 8)) {
+      if (!mResult.SetLength(mData.Length() + 8, fallible)) {
         return NS_ERROR_DOM_OPERATION_ERR;
       }
       SECItem resultItem = {siBuffer, mResult.Elements(),
                             (unsigned int) mResult.Length()};
       rv = MapSECStatus(PK11_WrapSymKey(mMechanism, nullptr, symKey.get(),
                                         keyToWrap.get(), &resultItem));
       NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_OPERATION_ERR);
     } else {
@@ -806,17 +806,17 @@ private:
     nsresult rv;
 
     if (!mDataIsSet) {
       return NS_ERROR_DOM_OPERATION_ERR;
     }
 
     // Ciphertext is an integer mod the modulus, so it will be
     // no longer than mStrength octets
-    if (!mResult.SetLength(mStrength)) {
+    if (!mResult.SetLength(mStrength, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     CK_RSA_PKCS_OAEP_PARAMS oaepParams;
     oaepParams.source = CKZ_DATA_SPECIFIED;
 
     oaepParams.pSourceData = mLabel.Length() ? mLabel.Elements() : nullptr;
     oaepParams.ulSourceDataLen = mLabel.Length();
@@ -896,17 +896,17 @@ private:
   CryptoBuffer mData;
   CryptoBuffer mSignature;
   CryptoBuffer mResult;
   bool mSign;
 
   virtual nsresult DoCrypto() override
   {
     // Initialize the output buffer
-    if (!mResult.SetLength(HASH_LENGTH_MAX)) {
+    if (!mResult.SetLength(HASH_LENGTH_MAX, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     ScopedPLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
     if (!arena) {
       return NS_ERROR_DOM_OPERATION_ERR;
     }
 
@@ -1178,17 +1178,17 @@ public:
 private:
   SECOidTag mOidTag;
   CryptoBuffer mData;
 
   virtual nsresult DoCrypto() override
   {
     // Resize the result buffer
     uint32_t hashLen = HASH_ResultLenByOidTag(mOidTag);
-    if (!mResult.SetLength(hashLen)) {
+    if (!mResult.SetLength(hashLen, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     // Compute the hash
     nsresult rv = MapSECStatus(PK11_HashBuf(mOidTag, mResult.Elements(),
                                             mData.Elements(), mData.Length()));
     if (NS_FAILED(rv)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
@@ -2592,17 +2592,17 @@ private:
     // just refers to a buffer managed by symKey. The assignment copies the
     // data, so mResult manages one copy, while symKey manages another.
     ATTEMPT_BUFFER_ASSIGN(mResult, PK11_GetKeyData(symKey));
 
     if (mLength > mResult.Length()) {
       return NS_ERROR_DOM_DATA_ERR;
     }
 
-    if (!mResult.SetLength(mLength)) {
+    if (!mResult.SetLength(mLength, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     return NS_OK;
   }
 };
 
 class DeriveDhBitsTask : public ReturnArrayBufferViewTask
@@ -2691,17 +2691,17 @@ private:
     // just refers to a buffer managed by symKey. The assignment copies the
     // data, so mResult manages one copy, while symKey manages another.
     ATTEMPT_BUFFER_ASSIGN(mResult, PK11_GetKeyData(symKey));
 
     if (mLength > mResult.Length()) {
       return NS_ERROR_DOM_DATA_ERR;
     }
 
-    if (!mResult.SetLength(mLength)) {
+    if (!mResult.SetLength(mLength, fallible)) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     return NS_OK;
   }
 };
 
 template<class KeyEncryptTask>
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -15766,17 +15766,17 @@ DatabaseOperationBase::GetStructuredClon
 
   size_t uncompressedLength;
   if (NS_WARN_IF(!snappy::GetUncompressedLength(compressed, compressedLength,
                                                 &uncompressedLength))) {
     return NS_ERROR_FILE_CORRUPTED;
   }
 
   AutoFallibleTArray<uint8_t, 512> uncompressed;
-  if (NS_WARN_IF(!uncompressed.SetLength(uncompressedLength))) {
+  if (NS_WARN_IF(!uncompressed.SetLength(uncompressedLength, fallible))) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   char* uncompressedBuffer = reinterpret_cast<char*>(uncompressed.Elements());
 
   if (NS_WARN_IF(!snappy::RawUncompress(compressed, compressedLength,
                                         uncompressedBuffer))) {
     return NS_ERROR_FILE_CORRUPTED;
@@ -21751,17 +21751,18 @@ ObjectStoreGetRequestOp::GetResponse(Req
 {
   MOZ_ASSERT_IF(mLimit, mResponse.Length() <= mLimit);
 
   if (mGetAll) {
     aResponse = ObjectStoreGetAllResponse();
 
     if (!mResponse.IsEmpty()) {
       FallibleTArray<SerializedStructuredCloneReadInfo> fallibleCloneInfos;
-      if (NS_WARN_IF(!fallibleCloneInfos.SetLength(mResponse.Length()))) {
+      if (NS_WARN_IF(!fallibleCloneInfos.SetLength(mResponse.Length(),
+                                                   fallible))) {
         aResponse = NS_ERROR_OUT_OF_MEMORY;
         return;
       }
 
       for (uint32_t count = mResponse.Length(), index = 0;
            index < count;
            index++) {
         nsresult rv = ConvertResponse(index, fallibleCloneInfos[index]);
@@ -22299,17 +22300,18 @@ IndexGetRequestOp::GetResponse(RequestRe
 {
   MOZ_ASSERT_IF(!mGetAll, mResponse.Length() <= 1);
 
   if (mGetAll) {
     aResponse = IndexGetAllResponse();
 
     if (!mResponse.IsEmpty()) {
       FallibleTArray<SerializedStructuredCloneReadInfo> fallibleCloneInfos;
-      if (NS_WARN_IF(!fallibleCloneInfos.SetLength(mResponse.Length()))) {
+      if (NS_WARN_IF(!fallibleCloneInfos.SetLength(mResponse.Length(),
+                                                   fallible))) {
         aResponse = NS_ERROR_OUT_OF_MEMORY;
         return;
       }
 
       for (uint32_t count = mResponse.Length(), index = 0;
            index < count;
            index++) {
         StructuredCloneReadInfo& info = mResponse[index];
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1173,17 +1173,18 @@ IDBObjectStore::AddOrPut(JSContext* aCx,
   nsTArray<IndexUpdateInfo> updateInfo;
 
   aRv = GetAddInfo(aCx, value, aKey, cloneWriteInfo, key, updateInfo);
   if (aRv.Failed()) {
     return nullptr;
   }
 
   FallibleTArray<uint8_t> cloneData;
-  if (NS_WARN_IF(!cloneData.SetLength(cloneWriteInfo.mCloneBuffer.nbytes()))) {
+  if (NS_WARN_IF(!cloneData.SetLength(cloneWriteInfo.mCloneBuffer.nbytes(),
+                                      fallible))) {
     aRv = NS_ERROR_OUT_OF_MEMORY;
     return nullptr;
   }
 
   // XXX Remove this
   memcpy(cloneData.Elements(), cloneWriteInfo.mCloneBuffer.data(),
          cloneWriteInfo.mCloneBuffer.nbytes());
 
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -963,17 +963,17 @@ CreateBlobImpl(const nsTArray<BlobData>&
     DebugOnly<bool> isMutable;
     MOZ_ASSERT(NS_SUCCEEDED(blobImpl->GetMutable(&isMutable)));
     MOZ_ASSERT(!isMutable);
 
     return blobImpl.forget();
   }
 
   FallibleTArray<nsRefPtr<BlobImpl>> fallibleBlobImpls;
-  if (NS_WARN_IF(!fallibleBlobImpls.SetLength(aBlobDatas.Length()))) {
+  if (NS_WARN_IF(!fallibleBlobImpls.SetLength(aBlobDatas.Length(), fallible))) {
     return nullptr;
   }
 
   nsTArray<nsRefPtr<BlobImpl>> blobImpls;
   fallibleBlobImpls.SwapElements(blobImpls);
 
   const bool hasRecursed = aMetadata.mHasRecursed;
   aMetadata.mHasRecursed = true;
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -620,17 +620,18 @@ bool
 MediaRawDataWriter::SetSize(size_t aSize)
 {
   if (aSize > mTarget->mSize && !EnsureSize(aSize)) {
     return false;
   }
 
   // Pad our buffer. We ensure sufficient capacity above so this shouldn't fail.
   MOZ_ALWAYS_TRUE(
-    mBuffer->SetLength(aSize + mTarget->mPadding + RAW_DATA_ALIGNMENT));
+    mBuffer->SetLength(aSize + mTarget->mPadding + RAW_DATA_ALIGNMENT,
+                       fallible));
   mTarget->mSize = mSize = aSize;
   return true;
 }
 
 bool
 MediaRawDataWriter::Prepend(const uint8_t* aData, size_t aSize)
 {
   if (!EnsureSize(aSize + mTarget->mSize)) {
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -30,17 +30,17 @@ MP4Demuxer::Init()
   AutoPinned<mp4_demuxer::ResourceStream> stream(mStream);
 
   // Check that we have enough data to read the metadata.
   MediaByteRange br = mp4_demuxer::MP4Metadata::MetadataRange(stream);
   if (br.IsNull()) {
     return InitPromise::CreateAndReject(DemuxerFailureReason::WAITING_FOR_DATA, __func__);
   }
 
-  if (!mInitData->SetLength(br.Length())) {
+  if (!mInitData->SetLength(br.Length(), fallible)) {
     // OOM
     return InitPromise::CreateAndReject(DemuxerFailureReason::DEMUXER_ERROR, __func__);
   }
 
   size_t size;
   mStream->ReadAt(br.mStart, mInitData->Elements(), br.Length(), &size);
   if (size != size_t(br.Length())) {
     return InitPromise::CreateAndReject(DemuxerFailureReason::DEMUXER_ERROR, __func__);
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -170,17 +170,17 @@ public:
     }
 
     // XXX This is a bit of a hack.  Assume if there are no timecodes
     // present and it's an init segment that it's _just_ an init segment.
     // We should be more precise.
     if (initSegment || !HasCompleteInitData()) {
       if (mParser.mInitEndOffset > 0) {
         MOZ_ASSERT(mParser.mInitEndOffset <= mResource->GetLength());
-        if (!mInitData->SetLength(mParser.mInitEndOffset)) {
+        if (!mInitData->SetLength(mParser.mInitEndOffset, fallible)) {
           // Super unlikely OOM
           return false;
         }
         char* buffer = reinterpret_cast<char*>(mInitData->Elements());
         mResource->ReadFromCache(buffer, 0, mParser.mInitEndOffset);
         MSE_DEBUG(WebMContainerParser, "Stashed init of %u bytes.",
                   mParser.mInitEndOffset);
         mResource = nullptr;
@@ -301,17 +301,17 @@ public:
       MediaByteRange(mParser->mOffset, mResource->GetLength());
     byteRanges.AppendElement(mbr);
     mParser->RebuildFragmentedIndex(byteRanges);
 
     if (initSegment || !HasCompleteInitData()) {
       const MediaByteRange& range = mParser->mInitRange;
       uint32_t length = range.mEnd - range.mStart;
       if (length) {
-        if (!mInitData->SetLength(length)) {
+        if (!mInitData->SetLength(length, fallible)) {
           // Super unlikely OOM
           return false;
         }
         char* buffer = reinterpret_cast<char*>(mInitData->Elements());
         mResource->ReadFromCache(buffer, range.mStart, length);
         MSE_DEBUG(MP4ContainerParser ,"Stashed init of %u bytes.",
                   length);
       } else {
--- a/dom/media/webaudio/AudioDestinationNode.cpp
+++ b/dom/media/webaudio/AudioDestinationNode.cpp
@@ -57,17 +57,17 @@ public:
     // will not go anywhere.
     *aOutput = aInput;
 
     // The output buffer is allocated lazily, on the rendering thread.
     if (!mBufferAllocated) {
       // These allocations might fail if content provides a huge number of
       // channels or size, but it's OK since we'll deal with the failure
       // gracefully.
-      if (mInputChannels.SetLength(mNumberOfChannels)) {
+      if (mInputChannels.SetLength(mNumberOfChannels, fallible)) {
         for (uint32_t i = 0; i < mNumberOfChannels; ++i) {
           mInputChannels[i] = new (fallible) float[mLength];
           if (!mInputChannels[i]) {
             mInputChannels.Clear();
             break;
           }
         }
       }
--- a/dom/media/webaudio/DelayBuffer.cpp
+++ b/dom/media/webaudio/DelayBuffer.cpp
@@ -191,17 +191,17 @@ DelayBuffer::EnsureBuffer()
 {
   if (mChunks.Length() == 0) {
     // The length of the buffer is at least one block greater than the maximum
     // delay so that writing an input block does not overwrite the block that
     // would subsequently be read at maximum delay.  Also round up to the next
     // block size, so that no block of writes will need to wrap.
     const int chunkCount = (mMaxDelayTicks + 2 * WEBAUDIO_BLOCK_SIZE - 1) >>
                                          WEBAUDIO_BLOCK_SIZE_BITS;
-    if (!mChunks.SetLength(chunkCount)) {
+    if (!mChunks.SetLength(chunkCount, fallible)) {
       return false;
     }
 
     mLastReadChunk = -1;
   }
   return true;
 }
 
--- a/dom/media/webaudio/MediaBufferDecoder.cpp
+++ b/dom/media/webaudio/MediaBufferDecoder.cpp
@@ -347,17 +347,17 @@ MediaDecodeTask::FinishDecode()
     speex_resampler_skip_zeros(resampler);
     resampledFrames += speex_resampler_get_output_latency(resampler);
   }
 
   // Allocate the channel buffers.  Note that if we end up resampling, we may
   // write fewer bytes than mResampledFrames to the output buffer, in which
   // case mWriteIndex will tell us how many valid samples we have.
   bool memoryAllocationSuccess = true;
-  if (!mDecodeJob.mChannelBuffers.SetLength(channelCount)) {
+  if (!mDecodeJob.mChannelBuffers.SetLength(channelCount, fallible)) {
     memoryAllocationSuccess = false;
   } else {
     for (uint32_t i = 0; i < channelCount; ++i) {
       mDecodeJob.mChannelBuffers[i] = new (fallible) float[resampledFrames];
       if (!mDecodeJob.mChannelBuffers[i]) {
         memoryAllocationSuccess = false;
         break;
       }
--- a/dom/mobilemessage/MobileMessageManager.cpp
+++ b/dom/mobilemessage/MobileMessageManager.cpp
@@ -351,17 +351,17 @@ MobileMessageManager::Delete(nsIDOMMozMm
 }
 
 already_AddRefed<DOMRequest>
 MobileMessageManager::Delete(const Sequence<OwningLongOrMozSmsMessageOrMozMmsMessage>& aParams,
                              ErrorResult& aRv)
 {
   const uint32_t size = aParams.Length();
   FallibleTArray<int32_t> idArray;
-  if (!idArray.SetLength(size)) {
+  if (!idArray.SetLength(size, fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
   }
 
   DebugOnly<nsresult> rv;
   for (uint32_t i = 0; i < size; i++) {
     const OwningLongOrMozSmsMessageOrMozMmsMessage& element = aParams[i];
     int32_t &id = idArray[i];
--- a/dom/plugins/ipc/PluginScriptableObjectChild.cpp
+++ b/dom/plugins/ipc/PluginScriptableObjectChild.cpp
@@ -773,17 +773,17 @@ PluginScriptableObjectChild::AnswerInvok
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, mozilla::fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     ConvertToVariant(aArgs[index], convertedArgs[index]);
   }
@@ -843,17 +843,17 @@ PluginScriptableObjectChild::AnswerInvok
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, mozilla::fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     ConvertToVariant(aArgs[index], convertedArgs[index]);
   }
@@ -1094,17 +1094,17 @@ PluginScriptableObjectChild::AnswerConst
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, mozilla::fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     ConvertToVariant(aArgs[index], convertedArgs[index]);
   }
--- a/dom/plugins/ipc/PluginScriptableObjectParent.cpp
+++ b/dom/plugins/ipc/PluginScriptableObjectParent.cpp
@@ -819,17 +819,17 @@ PluginScriptableObjectParent::AnswerInvo
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     if (!ConvertToVariant(aArgs[index], convertedArgs[index], instance)) {
       // Don't leak things we've already converted!
@@ -902,17 +902,17 @@ PluginScriptableObjectParent::AnswerInvo
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     if (!ConvertToVariant(aArgs[index], convertedArgs[index], instance)) {
       // Don't leak things we've already converted!
@@ -1222,17 +1222,17 @@ PluginScriptableObjectParent::AnswerCons
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   AutoFallibleTArray<NPVariant, 10> convertedArgs;
   uint32_t argCount = aArgs.Length();
 
-  if (!convertedArgs.SetLength(argCount)) {
+  if (!convertedArgs.SetLength(argCount, fallible)) {
     *aResult = void_t();
     *aSuccess = false;
     return true;
   }
 
   for (uint32_t index = 0; index < argCount; index++) {
     if (!ConvertToVariant(aArgs[index], convertedArgs[index], instance)) {
       // Don't leak things we've already converted!
--- a/dom/svg/DOMSVGLengthList.cpp
+++ b/dom/svg/DOMSVGLengthList.cpp
@@ -126,17 +126,17 @@ DOMSVGLengthList::InternalListLengthWill
 
   // If our length will decrease, notify the items that will be removed:
   for (uint32_t i = aNewLength; i < oldLength; ++i) {
     if (mItems[i]) {
       mItems[i]->RemovingFromList();
     }
   }
 
-  if (!mItems.SetLength(aNewLength)) {
+  if (!mItems.SetLength(aNewLength, fallible)) {
     // We silently ignore SetLength OOM failure since being out of sync is safe
     // so long as we have *fewer* items than our internal list.
     mItems.Clear();
     return;
   }
 
   // If our length has increased, null out the new pointers:
   for (uint32_t i = oldLength; i < aNewLength; ++i) {
--- a/dom/svg/DOMSVGNumberList.cpp
+++ b/dom/svg/DOMSVGNumberList.cpp
@@ -127,17 +127,17 @@ DOMSVGNumberList::InternalListLengthWill
 
   // If our length will decrease, notify the items that will be removed:
   for (uint32_t i = aNewLength; i < oldLength; ++i) {
     if (mItems[i]) {
       mItems[i]->RemovingFromList();
     }
   }
 
-  if (!mItems.SetLength(aNewLength)) {
+  if (!mItems.SetLength(aNewLength, fallible)) {
     // We silently ignore SetLength OOM failure since being out of sync is safe
     // so long as we have *fewer* items than our internal list.
     mItems.Clear();
     return;
   }
 
   // If our length has increased, null out the new pointers:
   for (uint32_t i = oldLength; i < aNewLength; ++i) {
--- a/dom/svg/DOMSVGPointList.cpp
+++ b/dom/svg/DOMSVGPointList.cpp
@@ -161,17 +161,17 @@ DOMSVGPointList::InternalListWillChangeT
 
   // If our length will decrease, notify the items that will be removed:
   for (uint32_t i = newLength; i < oldLength; ++i) {
     if (mItems[i]) {
       mItems[i]->RemovingFromList();
     }
   }
 
-  if (!mItems.SetLength(newLength)) {
+  if (!mItems.SetLength(newLength, fallible)) {
     // We silently ignore SetLength OOM failure since being out of sync is safe
     // so long as we have *fewer* items than our internal list.
     mItems.Clear();
     return;
   }
 
   // If our length has increased, null out the new pointers:
   for (uint32_t i = oldLength; i < newLength; ++i) {
--- a/dom/svg/DOMSVGTransformList.cpp
+++ b/dom/svg/DOMSVGTransformList.cpp
@@ -127,17 +127,17 @@ DOMSVGTransformList::InternalListLengthW
 
   // If our length will decrease, notify the items that will be removed:
   for (uint32_t i = aNewLength; i < oldLength; ++i) {
     if (mItems[i]) {
       mItems[i]->RemovingFromList();
     }
   }
 
-  if (!mItems.SetLength(aNewLength)) {
+  if (!mItems.SetLength(aNewLength, fallible)) {
     // We silently ignore SetLength OOM failure since being out of sync is safe
     // so long as we have *fewer* items than our internal list.
     mItems.Clear();
     return;
   }
 
   // If our length has increased, null out the new pointers:
   for (uint32_t i = oldLength; i < aNewLength; ++i) {
--- a/dom/svg/SVGLengthList.h
+++ b/dom/svg/SVGLengthList.h
@@ -85,17 +85,17 @@ protected:
     return mLengths[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aNumberOfItems) {
-    return mLengths.SetLength(aNumberOfItems);
+    return mLengths.SetLength(aNumberOfItems, fallible);
   }
 
 private:
 
   // Marking the following private only serves to show which methods are only
   // used by our friend classes (as opposed to our subclasses) - it doesn't
   // really provide additional safety.
 
--- a/dom/svg/SVGNumberList.h
+++ b/dom/svg/SVGNumberList.h
@@ -86,17 +86,17 @@ protected:
     return mNumbers[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aNumberOfItems) {
-    return mNumbers.SetLength(aNumberOfItems);
+    return mNumbers.SetLength(aNumberOfItems, fallible);
   }
 
 private:
 
   // Marking the following private only serves to show which methods are only
   // used by our friend classes (as opposed to our subclasses) - it doesn't
   // really provide additional safety.
 
--- a/dom/svg/SVGPathData.cpp
+++ b/dom/svg/SVGPathData.cpp
@@ -76,17 +76,17 @@ SVGPathData::SetValueFromString(const ns
   return pathParser.Parse() ? NS_OK : NS_ERROR_DOM_SYNTAX_ERR;
 }
 
 nsresult
 SVGPathData::AppendSeg(uint32_t aType, ...)
 {
   uint32_t oldLength = mData.Length();
   uint32_t newLength = oldLength + 1 + SVGPathSegUtils::ArgCountForType(aType);
-  if (!mData.SetLength(newLength)) {
+  if (!mData.SetLength(newLength, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mData[oldLength] = SVGPathSegUtils::EncodeType(aType);
   va_list args;
   va_start(args, aType);
   for (uint32_t i = oldLength + 1; i < newLength; ++i) {
     // NOTE! 'float' is promoted to 'double' when passed through '...'!
--- a/dom/svg/SVGPathData.h
+++ b/dom/svg/SVGPathData.h
@@ -197,17 +197,17 @@ protected:
     return mData[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aLength) {
-    return mData.SetLength(aLength);
+    return mData.SetLength(aLength, fallible);
   }
 
   nsresult SetValueFromString(const nsAString& aValue);
 
   void Clear() {
     mData.Clear();
   }
 
--- a/dom/svg/SVGPointList.h
+++ b/dom/svg/SVGPointList.h
@@ -94,17 +94,17 @@ protected:
     return mItems[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aNumberOfItems) {
-    return mItems.SetLength(aNumberOfItems);
+    return mItems.SetLength(aNumberOfItems, fallible);
   }
 
 private:
 
   // Marking the following private only serves to show which methods are only
   // used by our friend classes (as opposed to our subclasses) - it doesn't
   // really provide additional safety.
 
--- a/dom/svg/SVGStringList.h
+++ b/dom/svg/SVGStringList.h
@@ -87,17 +87,17 @@ protected:
     return mStrings[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aStringOfItems) {
-    return mStrings.SetLength(aStringOfItems);
+    return mStrings.SetLength(aStringOfItems, fallible);
   }
 
 private:
 
   // Marking the following private only serves to show which methods are only
   // used by our friend classes (as opposed to our subclasses) - it doesn't
   // really provide additional safety.
 
--- a/dom/svg/SVGTransformList.h
+++ b/dom/svg/SVGTransformList.h
@@ -89,17 +89,17 @@ protected:
     return mItems[aIndex];
   }
 
   /**
    * This may fail (return false) on OOM if the internal capacity is being
    * increased, in which case the list will be left unmodified.
    */
   bool SetLength(uint32_t aNumberOfItems) {
-    return mItems.SetLength(aNumberOfItems);
+    return mItems.SetLength(aNumberOfItems, fallible);
   }
 
 private:
 
   // Marking the following private only serves to show which methods are only
   // used by our friend classes (as opposed to our subclasses) - it doesn't
   // really provide additional safety.
 
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -456,17 +456,17 @@ gfxContext::SetDash(gfxFloat *dashes, in
 }
 
 bool
 gfxContext::CurrentDash(FallibleTArray<gfxFloat>& dashes, gfxFloat* offset) const
 {
   const AzureState &state = CurrentState();
   int count = state.strokeOptions.mDashLength;
 
-  if (count <= 0 || !dashes.SetLength(count)) {
+  if (count <= 0 || !dashes.SetLength(count, fallible)) {
     return false;
   }
 
   for (int i = 0; i < count; i++) {
     dashes[i] = state.dashPattern[i];
   }
 
   *offset = state.strokeOptions.mDashOffset;
--- a/gfx/thebes/gfxCoreTextShaper.cpp
+++ b/gfx/thebes/gfxCoreTextShaper.cpp
@@ -310,17 +310,17 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxS
     // We set the glyph index to NO_GLYPH for chars that have no associated glyph, and we
     // record the last glyph index for cases where the char maps to several glyphs,
     // so that our clumping will include all the glyph fragments for the character.
 
     // The charToGlyph array is indexed by char position within the stringRange of the glyph run.
 
     static const int32_t NO_GLYPH = -1;
     AutoFallibleTArray<int32_t,SMALL_GLYPH_RUN> charToGlyphArray;
-    if (!charToGlyphArray.SetLength(stringRange.length)) {
+    if (!charToGlyphArray.SetLength(stringRange.length, fallible)) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
     int32_t *charToGlyph = charToGlyphArray.Elements();
     for (int32_t offset = 0; offset < stringRange.length; ++offset) {
         charToGlyph[offset] = NO_GLYPH;
     }
     for (int32_t i = 0; i < numGlyphs; ++i) {
         int32_t loc = glyphToChar[i] - stringRange.location;
--- a/gfx/thebes/gfxGraphiteShaper.cpp
+++ b/gfx/thebes/gfxGraphiteShaper.cpp
@@ -208,20 +208,20 @@ gfxGraphiteShaper::SetGlyphsFromSegment(
     uint32_t glyphCount = gr_seg_n_slots(aSegment);
 
     // identify clusters; graphite may have reordered/expanded/ligated glyphs.
     AutoFallibleTArray<Cluster,SMALL_GLYPH_RUN> clusters;
     AutoFallibleTArray<uint16_t,SMALL_GLYPH_RUN> gids;
     AutoFallibleTArray<float,SMALL_GLYPH_RUN> xLocs;
     AutoFallibleTArray<float,SMALL_GLYPH_RUN> yLocs;
 
-    if (!clusters.SetLength(aLength) ||
-        !gids.SetLength(glyphCount) ||
-        !xLocs.SetLength(glyphCount) ||
-        !yLocs.SetLength(glyphCount))
+    if (!clusters.SetLength(aLength, fallible) ||
+        !gids.SetLength(glyphCount, fallible) ||
+        !xLocs.SetLength(glyphCount, fallible) ||
+        !yLocs.SetLength(glyphCount, fallible))
     {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // walk through the glyph slots and check which original character
     // each is associated with
     uint32_t gIndex = 0; // glyph slot index
     uint32_t cIndex = 0; // current cluster index
--- a/gfx/thebes/gfxHarfBuzzShaper.cpp
+++ b/gfx/thebes/gfxHarfBuzzShaper.cpp
@@ -1529,17 +1529,17 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxC
         return NS_OK;
     }
 
     nsAutoTArray<gfxTextRun::DetailedGlyph,1> detailedGlyphs;
 
     uint32_t wordLength = aLength;
     static const int32_t NO_GLYPH = -1;
     AutoFallibleTArray<int32_t,SMALL_GLYPH_RUN> charToGlyphArray;
-    if (!charToGlyphArray.SetLength(wordLength)) {
+    if (!charToGlyphArray.SetLength(wordLength, fallible)) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     int32_t *charToGlyph = charToGlyphArray.Elements();
     for (uint32_t offset = 0; offset < wordLength; ++offset) {
         charToGlyph[offset] = NO_GLYPH;
     }
 
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -365,17 +365,17 @@ CopyWOFFMetadata(const uint8_t* aFontDat
     uint32_t metaOffset = woff->metaOffset;
     uint32_t metaCompLen = woff->metaCompLen;
     if (!metaOffset || !metaCompLen || !woff->metaOrigLen) {
         return;
     }
     if (metaOffset >= aLength || metaCompLen > aLength - metaOffset) {
         return;
     }
-    if (!aMetadata->SetLength(woff->metaCompLen)) {
+    if (!aMetadata->SetLength(woff->metaCompLen, fallible)) {
         return;
     }
     memcpy(aMetadata->Elements(), aFontData + metaOffset, metaCompLen);
     *aMetaOrigLen = woff->metaOrigLen;
 }
 
 void
 gfxUserFontEntry::LoadNextSrc()
--- a/intl/hyphenation/nsHyphenator.cpp
+++ b/intl/hyphenation/nsHyphenator.cpp
@@ -41,17 +41,17 @@ nsHyphenator::IsValid()
 {
   return (mDict != nullptr);
 }
 
 nsresult
 nsHyphenator::Hyphenate(const nsAString& aString,
                         FallibleTArray<bool>& aHyphens)
 {
-  if (!aHyphens.SetLength(aString.Length())) {
+  if (!aHyphens.SetLength(aString.Length(), mozilla::fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   memset(aHyphens.Elements(), false, aHyphens.Length() * sizeof(bool));
 
   bool inWord = false;
   uint32_t wordStart = 0, wordLimit = 0;
   uint32_t chLen;
   for (uint32_t i = 0; i < aString.Length(); i += chLen) {
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -338,17 +338,17 @@ def _cxxArrayType(basetype, const=0, ref
 def _cxxFallibleArrayType(basetype, const=0, ref=0):
     return Type('FallibleTArray', T=basetype, const=const, ref=ref)
 
 def _callCxxArrayLength(arr):
     return ExprCall(ExprSelect(arr, '.', 'Length'))
 
 def _callCxxCheckedArraySetLength(arr, lenexpr, sel='.'):
     ifbad = StmtIf(ExprNot(ExprCall(ExprSelect(arr, sel, 'SetLength'),
-                                    args=[ lenexpr ])))
+                                    args=[ lenexpr, ExprVar('mozilla::fallible') ])))
     ifbad.addifstmt(_fatalError('Error setting the array length'))
     ifbad.addifstmt(StmtReturn.FALSE)
     return ifbad
 
 def _callCxxSwapArrayElements(arr1, arr2, sel='.'):
     return ExprCall(ExprSelect(arr1, sel, 'SwapElements'),
                     args=[ arr2 ])
 
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -1449,17 +1449,17 @@ GetStrokeDashData(nsIFrame* aFrame,
       if (aDashes[i] < 0.0) {
         return false;
       }
       totalLength += aDashes[i];
     }
 
   } else {
     uint32_t count = style->mStrokeDasharrayLength;
-    if (!count || !aDashes.SetLength(count)) {
+    if (!count || !aDashes.SetLength(count, fallible)) {
       return false;
     }
 
     gfxFloat pathScale = 1.0;
 
     if (content->IsSVGElement(nsGkAtoms::path)) {
       pathScale = static_cast<SVGPathElement*>(content)->
         GetPathLengthScale(SVGPathElement::eForStroking);
--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
@@ -2200,17 +2200,17 @@ status_t MPEG4Extractor::parseTrackHeade
 }
 
 status_t MPEG4Extractor::parseMetaData(off64_t offset, size_t size) {
     if (size < 4) {
         return ERROR_MALFORMED;
     }
 
     FallibleTArray<uint8_t> bufferBackend;
-    if (!bufferBackend.SetLength(size + 1)) {
+    if (!bufferBackend.SetLength(size + 1, mozilla::fallible)) {
         // OOM ignore metadata.
         return OK;
     }
 
     uint8_t *buffer = bufferBackend.Elements();
     if (mDataSource->readAt(
                 offset, buffer, size) != (ssize_t)size) {
         return ERROR_IO;
@@ -3347,17 +3347,17 @@ status_t MPEG4Source::lookForMoof() {
         offset += chunk_size;
     }
 }
 
 bool MPEG4Source::ensureSrcBufferAllocated(int32_t aSize) {
     if (mSrcBackend.Length() >= aSize) {
         return true;
     }
-    if (!mSrcBackend.SetLength(aSize)) {
+    if (!mSrcBackend.SetLength(aSize, mozilla::fallible)) {
         ALOGE("Error insufficient memory, requested %u bytes (had:%u)",
               aSize, mSrcBackend.Length());
         return false;
     }
     mSrcBuffer = mSrcBackend.Elements();
     return true;
 }
 
--- a/media/libstagefright/frameworks/av/media/libstagefright/MediaBuffer.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MediaBuffer.cpp
@@ -199,17 +199,17 @@ MediaBuffer *MediaBuffer::clone() {
 bool MediaBuffer::ensuresize(size_t length) {
     if (mBufferBackend.Length() >= length) {
         return true;
     }
     // Can't reallocate data we don't owned or shared with another.
     if (!mOwnsData || refcount()) {
         return false;
     }
-    if (!mBufferBackend.SetLength(length)) {
+    if (!mBufferBackend.SetLength(length, mozilla::fallible)) {
         return false;
     }
     mData = mBufferBackend.Elements();
     mSize = length;
     return true;
 }
 
 }  // namespace stagefright
--- a/toolkit/components/url-classifier/ChunkSet.cpp
+++ b/toolkit/components/url-classifier/ChunkSet.cpp
@@ -76,17 +76,17 @@ ChunkSet::Remove(const ChunkSet& aOther)
 
   for (uint32_t *iter = addIter; iter != end; iter++) {
     if (!aOther.Has(*iter)) {
       *addIter = *iter;
       addIter++;
     }
   }
 
-  if (!mChunks.SetLength(addIter - mChunks.Elements())) {
+  if (!mChunks.SetLength(addIter - mChunks.Elements(), fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
 
 void
 ChunkSet::Clear()
--- a/toolkit/components/url-classifier/Entries.h
+++ b/toolkit/components/url-classifier/Entries.h
@@ -284,17 +284,17 @@ ReadTArray(nsIInputStream* aStream, nsTA
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
 
 template<class T>
 nsresult
 ReadTArray(nsIInputStream* aStream, FallibleTArray<T>* aArray, uint32_t aNumElements)
 {
-  if (!aArray->SetLength(aNumElements))
+  if (!aArray->SetLength(aNumElements, fallible))
     return NS_ERROR_OUT_OF_MEMORY;
 
   void *buffer = aArray->Elements();
   nsresult rv = NS_ReadInputStreamToBuffer(aStream, &buffer,
                                            (aNumElements * sizeof(T)));
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -574,17 +574,17 @@ HashStore::Expire()
 }
 
 template<class T>
 nsresult DeflateWriteTArray(nsIOutputStream* aStream, nsTArray<T>& aIn)
 {
   uLongf insize = aIn.Length() * sizeof(T);
   uLongf outsize = compressBound(insize);
   FallibleTArray<char> outBuff;
-  if (!outBuff.SetLength(outsize)) {
+  if (!outBuff.SetLength(outsize, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   int zerr = compress(reinterpret_cast<Bytef*>(outBuff.Elements()),
                       &outsize,
                       reinterpret_cast<const Bytef*>(aIn.Elements()),
                       insize);
   if (zerr != Z_OK) {
@@ -617,26 +617,26 @@ nsresult InflateReadTArray(nsIInputStrea
   uint32_t inLen;
   uint32_t read;
   nsresult rv = aStream->Read(reinterpret_cast<char*>(&inLen), sizeof(inLen), &read);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ASSERTION(read == sizeof(inLen), "Error reading inflate length");
 
   FallibleTArray<char> inBuff;
-  if (!inBuff.SetLength(inLen)) {
+  if (!inBuff.SetLength(inLen, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   rv = ReadTArray(aStream, &inBuff, inLen);
   NS_ENSURE_SUCCESS(rv, rv);
 
   uLongf insize = inLen;
   uLongf outsize = aExpectedSize * sizeof(T);
-  if (!aOut->SetLength(aExpectedSize)) {
+  if (!aOut->SetLength(aExpectedSize, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   int zerr = uncompress(reinterpret_cast<Bytef*>(aOut->Elements()),
                         &outsize,
                         reinterpret_cast<const Bytef*>(inBuff.Elements()),
                         insize);
   if (zerr != Z_OK) {
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -128,17 +128,17 @@ nsUrlClassifierPrefixSet::MakePrefixSet(
   LOG(("Total number of delta chunks: %d", mIndexDeltas.Length()));
 
   return NS_OK;
 }
 
 nsresult
 nsUrlClassifierPrefixSet::GetPrefixesNative(FallibleTArray<uint32_t>& outArray)
 {
-  if (!outArray.SetLength(mTotalPrefixes)) {
+  if (!outArray.SetLength(mTotalPrefixes, fallible)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   uint32_t prefixIdxLength = mIndexPrefixes.Length();
   uint32_t prefixCnt = 0;
 
   for (uint32_t i = 0; i < prefixIdxLength; i++) {
     uint32_t prefix = mIndexPrefixes[i];