Bug 1409641: Get the result only when it's defined in IDBtranscation. r=janv

--HG--
extra : rebase_source : 005404b167d8399263acb52021cce9222dfb7536
This commit is contained in:
Tom Tung 2018-08-16 16:09:40 +02:00
Родитель 152366b300
Коммит e66bb71c21
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -160,21 +160,21 @@ IndexedDBHelper.prototype = {
stores = txn.objectStore(store_name); stores = txn.objectStore(store_name);
} }
txn.oncomplete = function (event) { txn.oncomplete = function () {
if (DEBUG) debug("Transaction complete. Returning to callback."); if (DEBUG) debug("Transaction complete. Returning to callback.");
if (successCb) { if (successCb) {
if ("result" in txn) {
successCb(txn.result); successCb(txn.result);
} else {
successCb();
}
} }
}; };
txn.onabort = function (event) { txn.onabort = function () {
if (DEBUG) debug("Caught error on transaction"); if (DEBUG) debug("Caught error on transaction");
/*
* event.target.error may be null
* if txn was aborted by calling txn.abort()
*/
if (failureCb) { if (failureCb) {
failureCb(getErrorName(event.target.error)); failureCb(getErrorName(txn.error));
} }
}; };
callback(txn, stores); callback(txn, stores);