Bug 1646006 - Check if CreateFileInfo returns nullptr. r=janv, a=tritter
authorSimon Giesecke <sgiesecke@mozilla.com>
Tue, 30 Jun 2020 09:47:22 +0000
changeset 601899 0e15c28add1f726901bfd13472f637b2a86dc417
parent 601898 6c4742da42164a127e89e5a300a503066fc21cca
child 601900 826468e886b2c1b9346f396702b90fc62ffe8c79
push id13344
push userryanvm@gmail.com
push dateFri, 03 Jul 2020 00:16:09 +0000
treeherdermozilla-beta@51bedc350693 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv, tritter
bugs1646006
milestone79.0
Bug 1646006 - Check if CreateFileInfo returns nullptr. r=janv, a=tritter Differential Revision: https://phabricator.services.mozilla.com/D79835
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -14030,17 +14030,19 @@ Database::AllocPBackgroundIDBDatabaseFil
   SafeRefPtr<FileInfo> fileInfo = GetBlob(aIPCBlob);
   RefPtr<DatabaseFile> actor;
 
   if (fileInfo) {
     actor = new DatabaseFile(std::move(fileInfo));
   } else {
     // This is a blob we haven't seen before.
     fileInfo = mFileManager->CreateFileInfo();
-    MOZ_ASSERT(fileInfo);
+    if (NS_WARN_IF(!fileInfo)) {
+      return nullptr;
+    }
 
     actor = new DatabaseFile(IPCBlobUtils::Deserialize(aIPCBlob),
                              std::move(fileInfo));
   }
 
   MOZ_ASSERT(actor);
 
   return actor.forget().take();
@@ -25057,18 +25059,24 @@ bool ObjectStoreAddOrPutRequestOp::Init(
       fallible);
   if (NS_WARN_IF(storedFileInfosOrErr.isErr())) {
     return false;
   }
 
   mStoredFileInfos = storedFileInfosOrErr.unwrap();
 
   if (mDataOverThreshold) {
+    auto fileInfo =
+        aTransaction.GetDatabase().GetFileManager().CreateFileInfo();
+    if (NS_WARN_IF(!fileInfo)) {
+      return false;
+    }
+
     mStoredFileInfos.EmplaceBack(StoredFileInfo::CreateForStructuredClone(
-        aTransaction.GetDatabase().GetFileManager().CreateFileInfo(),
+        std::move(fileInfo),
         MakeRefPtr<SCInputStream>(mParams.cloneInfo().data().data)));
   }
 
   return true;
 }
 
 nsresult ObjectStoreAddOrPutRequestOp::DoDatabaseWork(
     DatabaseConnection* aConnection) {