Bug 1409641: Get the result only when it's defined in IDBtranscation. r=janv
authorTom Tung <shes050117@gmail.com>
Thu, 16 Aug 2018 16:09:40 +0200
changeset 432083 3f0e23762df5816b8a28819865679e960c2dbfac
parent 432082 5fcbe08fb321a5076f56c380b554c63068efbb00
child 432084 cf257868689ac19d05c88e0b2607b180373cfcb3
push id34458
push userebalazs@mozilla.com
push dateFri, 17 Aug 2018 09:46:42 +0000
treeherdermozilla-central@b84213ec5a4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1409641
milestone63.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 1409641: Get the result only when it's defined in IDBtranscation. r=janv
dom/base/IndexedDBHelper.jsm
--- a/dom/base/IndexedDBHelper.jsm
+++ b/dom/base/IndexedDBHelper.jsm
@@ -155,31 +155,31 @@ IndexedDBHelper.prototype = {
         stores = [];
         for (let i = 0; i < store_name.length; ++i) {
           stores.push(txn.objectStore(store_name[i]));
         }
       } else {
         stores = txn.objectStore(store_name);
       }
 
-      txn.oncomplete = function (event) {
+      txn.oncomplete = function () {
         if (DEBUG) debug("Transaction complete. Returning to callback.");
         if (successCb) {
-          successCb(txn.result);
+          if ("result" in txn) {
+            successCb(txn.result);
+          } else {
+            successCb();
+          }
         }
       };
 
-      txn.onabort = function (event) {
+      txn.onabort = function () {
         if (DEBUG) debug("Caught error on transaction");
-        /*
-         * event.target.error may be null
-         * if txn was aborted by calling txn.abort()
-         */
         if (failureCb) {
-          failureCb(getErrorName(event.target.error));
+          failureCb(getErrorName(txn.error));
         }
       };
       callback(txn, stores);
     }, failureCb);
   },
 
   /**
    * Initialize the DB. Does not call open.