B2G/gecko/dom/base/IndexedDBHelper.jsm
/**
   * Start a new transaction.
   *
   * @param txn_type
   *        Type of transaction (e.g. "readwrite")
   * @param store_name
   *        The object store you want to be passed to the callback
   * @param callback
   *        Function to call when the transaction is available. It will
   *        be invoked with the transaction and the `store_name' object store.
   * @param successCb
   *        Success callback to call on a successful transaction commit.
   *        The result is stored in txn.result.
   * @param failureCb
   *        Error callback to call when an error is encountered.
   */
Start a new transaction.
@param txn_type
Type of transaction
@param store_name
The object store you want to be passed to the callback
@param callback
Function to call when the transaction is available. It will
be invoked with the transaction and the `store_name' object store.
@param successCb
Success callback to call on a successful transaction commit.
The result is stored in txn.result.
@param failureCb
Error callback to call when an error is encountered.
Start a new transaction . @param txn_type Type of transaction @param store_name The object store you want to be passed to the callback @param callback Function to call when the transaction is available . It will be invoked with the transaction and the ` store_name ' object store . @param successCb Success callback to call on a successful transaction commit . The result is stored in txn . result . @param failureCb Error callback to call when an error is encountered .
function newTxn(txn_type, store_name, callback, successCb, failureCb) {
    this.ensureDB(function () {
      if (DEBUG) debug("Starting new transaction" + txn_type);
      let txn = this._db.transaction(this.dbStoreNames, txn_type);
      if (DEBUG) debug("Retrieving object store", this.dbName);
      let store = txn.objectStore(store_name);
      txn.oncomplete = function (event) {
        if (DEBUG) debug("Transaction complete. Returning to callback.");
        if (successCb) {
          successCb(txn.result);
        }
      };
      txn.onabort = function (event) {
        if (DEBUG) debug("Caught error on transaction");
        if (failureCb) {
          failureCb("UnknownError");
        }
      };
      callback(txn, store);
    }.bind(this), failureCb);
  }
function newTxn ( txn_type , store_name , callback , successCb , failureCb ) { this . ensureDB ( function ( ) { if ( DEBUG ) debug ( "Starting new transaction" + txn_type ) ; let txn = this . _db . transaction ( this . dbStoreNames , txn_type ) ; if ( DEBUG ) debug ( "Retrieving object store" , this . dbName ) ; let store = txn . objectStore ( store_name ) ; txn . oncomplete = function ( event ) { if ( DEBUG ) debug ( "Transaction complete. Returning to callback." ) ; if ( successCb ) { successCb ( txn . result ) ; } } ; txn . onabort = function ( event ) { if ( DEBUG ) debug ( "Caught error on transaction" ) ; if ( failureCb ) { failureCb ( "UnknownError" ) ; } } ; callback ( txn , store ) ; } . bind ( this ) , failureCb ) ; }
Start a new transaction.
Start a new transaction .
// FIXXMEE: this will work in the future. Bug 748630 // failureCb(event.target.error.name);