Bug 822406 - Use transaction.error.name when possible. r=gwagner
authorNikhil Marathe <nsm.nikhil@gmail.com>
Mon, 17 Dec 2012 20:53:39 -0500
changeset 125472 ab006da8f88df746b52eeb1d580b1aa21a6ccf8c
parent 125471 92b58637064edb3bd8ac5b869d1146db7ff7f1ee
child 125473 664be99e44f62668138aea79a5f3a33ef103fb78
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner
bugs822406
milestone20.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 822406 - Use transaction.error.name when possible. r=gwagner
dom/base/IndexedDBHelper.jsm
--- a/dom/base/IndexedDBHelper.jsm
+++ b/dom/base/IndexedDBHelper.jsm
@@ -113,19 +113,24 @@ IndexedDBHelper.prototype = {
 
       txn.oncomplete = function (event) {
         debug("Transaction complete. Returning to callback.");
         successCb(txn.result);
       };
 
       txn.onabort = function (event) {
         debug("Caught error on transaction");
-        // FIXXMEE: this will work in the future. Bug 748630
-        // failureCb(event.target.error.name);
-        failureCb("UnknownError");
+        /*
+         * event.target.error may be null
+         * if txn was aborted by calling txn.abort()
+         */
+        if (event.target.error)
+            failureCb(event.target.error.name);
+        else
+            failureCb("UnknownError");
       };
       callback(txn, store);
     }.bind(this), failureCb);
   },
 
   /**
    * Initialize the DB. Does not call open.
    *