Bug 1539261, part 1 - IndexedDB changes. r=asuth
authorAndrew McCreight <continuation@gmail.com>
Wed, 27 Mar 2019 20:41:10 +0000
changeset 466453 054cbaead3039d477667f2a0ef400e44015543c8
parent 466452 8d043fdfac71edb9ccda79987f95dae1ed02b434
child 466454 ebcc9bb7c50aa1f28ca7888cf10f7772a56c9db4
push id35768
push useropoprus@mozilla.com
push dateThu, 28 Mar 2019 09:55:54 +0000
treeherdermozilla-central@c045dd97faf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1539261
milestone68.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 1539261, part 1 - IndexedDB changes. r=asuth The second place doesn't return an error because that's what some earlier code in the method does. Hopefully that is ok. Differential Revision: https://phabricator.services.mozilla.com/D24991
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -23995,17 +23995,20 @@ nsresult ObjectStoreAddOrPutRequestOp::D
     rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("data"), data);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   } else {
     nsCString flatCloneData;
     flatCloneData.SetLength(cloneDataSize);
     auto iter = cloneData.Start();
-    cloneData.ReadBytes(iter, flatCloneData.BeginWriting(), cloneDataSize);
+    if (NS_WARN_IF(!cloneData.ReadBytes(iter, flatCloneData.BeginWriting(),
+                                        cloneDataSize))) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
 
     // Compress the bytes before adding into the database.
     const char* uncompressed = flatCloneData.BeginReading();
     size_t uncompressedLength = cloneDataSize;
 
     size_t compressedLength = snappy::MaxCompressedLength(uncompressedLength);
 
     UniqueFreePtr<char> compressed(
@@ -24234,17 +24237,20 @@ ObjectStoreAddOrPutRequestOp::SCInputStr
     }
 
     // Writer should write what we asked it to write.
     MOZ_ASSERT(written == count);
 
     *_retval += count;
     aCount -= count;
 
-    mData.Advance(mIter, count);
+    if (NS_WARN_IF(!mData.Advance(mIter, count))) {
+      // InputStreams do not propagate errors to caller.
+      return NS_OK;
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ObjectStoreAddOrPutRequestOp::SCInputStream::IsNonBlocking(bool* _retval) {
   *_retval = false;