Bug 1432133 - P1 - Returning an error when FileInfo is missing as a short-term fix; r=asuth, data-review=chutten
authorTom Tung <shes050117@gmail.com>
Wed, 16 Jan 2019 10:24:56 +0000
changeset 511177 08dccff23fbbceb21178a1379bf7a60616fb77ae
parent 511176 a56825e2ea2c5b1a2ffb15c813d5d699475f98dc
child 511178 475348be3c9463b96ee614c44afe33e3db17e960
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1432133
milestone66.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 1432133 - P1 - Returning an error when FileInfo is missing as a short-term fix; r=asuth, data-review=chutten 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
@@ -2024,16 +2024,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