indexeddbshim 17.5.0 → 17.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "17.5.0",
3
+ "version": "17.6.0",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
@@ -56,7 +56,7 @@ const readonlyProperties = ['objectStoreNames', 'mode', 'durability', 'db', 'err
56
56
  * __requestsFinished: boolean,
57
57
  * __transFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
58
58
  * __callTransFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
59
- * __transactionEndCallback: () => void,
59
+ * __transactionEndCallback: (() => void)|undefined,
60
60
  * __transactionFinished: boolean,
61
61
  * __completed: boolean,
62
62
  * __transFinishedCbFired: boolean,
@@ -91,6 +91,19 @@ const readonlyProperties = ['objectStoreNames', 'mode', 'durability', 'db', 'err
91
91
  * }} IDBTransactionFull
92
92
  */
93
93
 
94
+ /**
95
+ * @param {IDBTransactionFull} tx
96
+ * @returns {void}
97
+ */
98
+ function releaseFinishedTransaction (tx) {
99
+ const pos = tx.db.__transactions.indexOf(tx);
100
+ if (pos !== -1) {
101
+ tx.db.__transactions.splice(pos, 1);
102
+ }
103
+ tx.__transactionEndCallback = undefined;
104
+ tx.__requests = [];
105
+ }
106
+
94
107
  /**
95
108
  * The IndexedDB Transaction.
96
109
  * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction
@@ -645,6 +658,7 @@ IDBTransaction.prototype.__executeRequests = function () {
645
658
  } finally {
646
659
  activeTransactions.delete(me);
647
660
  me.__storeHandles = {};
661
+ releaseFinishedTransaction(me);
648
662
  }
649
663
  }
650
664
  if (me.mode === 'readwrite' || me.mode === 'readonly') {
@@ -928,6 +942,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
928
942
  me.dispatchEvent(evt);
929
943
  me.__storeHandles = {};
930
944
  me.dispatchEvent(createEvent('__abort'));
945
+ releaseFinishedTransaction(me);
931
946
  }, 0);
932
947
  return undefined;
933
948
  }).catch((err) => {