Bug 1422335 - Using a sandbox on main-thread when deserializing data for IDB - part 4 - Correct deserialization of wasm modules, r=asuth
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 18 Jan 2018 13:19:07 +0100
changeset 454136 bfa90e7a245f0496e9434796681674f7b5f54ace
parent 454135 bf4858a603292b46437715c42fde0e495c8bad22
child 454137 71516540db51fd17d6d938ea224c3231fe636fd5
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1422335
milestone59.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 1422335 - Using a sandbox on main-thread when deserializing data for IDB - part 4 - Correct deserialization of wasm modules, r=asuth
dom/indexedDB/IDBObjectStore.cpp
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1010,17 +1010,30 @@ public:
   CreateAndWrapWasmModule(JSContext* aCx,
                           StructuredCloneFile& aFile,
                           const WasmModuleData& aData,
                           JS::MutableHandle<JSObject*> aResult)
   {
     MOZ_ASSERT(aCx);
     MOZ_ASSERT(aFile.mType == StructuredCloneFile::eWasmCompiled);
     MOZ_ASSERT(!aFile.mBlob);
-    MOZ_ASSERT(aFile.mWasmModule);
+
+    // If we don't have a WasmModule, we are probably using it for an index
+    // creation, but Wasm module can't be used in index creation, so just make a
+    // dummy object.
+    if (!aFile.mWasmModule) {
+      JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
+
+      if (NS_WARN_IF(!obj)) {
+        return false;
+      }
+
+      aResult.set(obj);
+      return true;
+    }
 
     JS::Rooted<JSObject*> moduleObj(aCx, aFile.mWasmModule->createObject(aCx));
     if (NS_WARN_IF(!moduleObj)) {
       return false;
     }
 
     aResult.set(moduleObj);
     return true;