Bug 939440 - Out of memory reported when blobs are created, r=bz
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 05 Dec 2013 09:30:33 +0000
changeset 174579 d9133077f7cf7b6e16df0385dbafcc472624d93e
parent 174519 056164bcce96df11121687fd95fa2e149774773a
child 174580 f56bfb99d97156c215fb25ef344e9860f96e9d43
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs939440
milestone28.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 939440 - Out of memory reported when blobs are created, r=bz
content/base/src/nsDOMBlobBuilder.cpp
--- a/content/base/src/nsDOMBlobBuilder.cpp
+++ b/content/base/src/nsDOMBlobBuilder.cpp
@@ -252,30 +252,35 @@ nsDOMMultipartFile::ParseBlobArrayArgume
         if (subBlobs) {
           blobSet.AppendBlobs(*subBlobs);
         } else {
           blobSet.AppendBlob(blob);
         }
         continue;
       }
       if (JS_IsArrayBufferViewObject(obj)) {
-        blobSet.AppendVoidPtr(JS_GetArrayBufferViewData(obj),
-                              JS_GetArrayBufferViewByteLength(obj));
+        nsresult rv = blobSet.AppendVoidPtr(
+                                          JS_GetArrayBufferViewData(obj),
+                                          JS_GetArrayBufferViewByteLength(obj));
+        NS_ENSURE_SUCCESS(rv, rv);
         continue;
       }
       if (JS_IsArrayBufferObject(obj)) {
-        blobSet.AppendArrayBuffer(obj);
+        nsresult rv = blobSet.AppendArrayBuffer(obj);
+        NS_ENSURE_SUCCESS(rv, rv);
         continue;
       }
     }
 
     // coerce it to a string
     JSString* str = JS::ToString(aCx, element);
     NS_ENSURE_TRUE(str, NS_ERROR_TYPE_ERR);
-    blobSet.AppendString(str, aNativeEOL, aCx);
+
+    nsresult rv = blobSet.AppendString(str, aNativeEOL, aCx);
+    NS_ENSURE_SUCCESS(rv, rv);
   }
 
   mBlobs = blobSet.GetBlobs();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMMultipartFile::GetMozFullPathInternal(nsAString &aFilename)