Bug 1432133 - Returning an error when FileInfo is missing as a short-term fix. r=asuth, data-review=chutten, a=RyanVM
authorTom Tung <shes050117@gmail.com>
Wed, 16 Jan 2019 10:24:56 +0000
changeset 509529 73101717e0676ee8ead22272dc3df324db94b87a
parent 509528 69143a6c191dd9d8742568548fcf7981a0ceb91d
child 509530 21ebd471d7a645f5b501abbb194f4696195dae63
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, RyanVM
bugs1432133
milestone65.0
Bug 1432133 - Returning an error when FileInfo is missing as a short-term fix. r=asuth, data-review=chutten, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D16045
dom/indexedDB/ActorsParent.cpp
toolkit/components/telemetry/Scalars.yaml
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -28,16 +28,17 @@
 #include "mozilla/ErrorNames.h"
 #include "mozilla/LazyIdleThread.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SnappyCompressOutputStream.h"
 #include "mozilla/SnappyUncompressInputStream.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/storage.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FileBlobImpl.h"
 #include "mozilla/dom/StructuredCloneTags.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/filehandle/ActorsParent.h"
@@ -8324,16 +8325,27 @@ nsresult DeserializeStructuredCloneFile(
     id = text.ToInteger(&rv);
   }
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   RefPtr<FileInfo> fileInfo = aFileManager->GetFileInfo(id);
   MOZ_ASSERT(fileInfo);
+  // XXX In bug 1432133, for some reasons FileInfo object cannot be got. This
+  // is just a short-term fix, and we are working on finding the real cause
+  // in bug 1519859.
+  if (!fileInfo) {
+    IDB_WARNING(
+        "Corrupt structured clone data detected in IndexedDB. Failing the "
+        "database request. Bug 1519859 will address this problem.");
+    Telemetry::ScalarAdd(Telemetry::ScalarID::IDB_FAILURE_FILEINFO_ERROR, 1);
+
+    return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
+  }
 
   aFile->mFileInfo.swap(fileInfo);
   aFile->mType = type;
 
   return NS_OK;
 }
 
 nsresult DeserializeStructuredCloneFiles(FileManager* aFileManager,
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -2023,16 +2023,32 @@ idb.type:
     kind: uint
     notification_emails:
       - shuang@mozilla.com
     release_channel_collection: opt-in
     record_in_processes:
       - 'main'
       - 'content'
 
+# The following section is for tracking the number of failure for indexedDB.
+idb.failure:
+  fileinfo_error:
+    bug_numbers:
+      - 1432133
+    description: >
+      Tracking the number of failure due to missing fileInfo while doing
+      structured clone.
+    expires: "70"
+    kind: uint
+    notification_emails:
+      - ttung@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
 # The following section contains probes that record timestamps.
 timestamps:
   first_paint:
     bug_numbers:
       - 1386186
     description: >
      Record the timestamp of the first content window paint, in milliseconds since process start.
     expires: never