Skip to content

Commit 941d1e1

Browse files
committed
fix: clear out __transactions tracking array after db closes
1 parent 7c95f38 commit 941d1e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/IDBDatabase.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const readonlyProperties = ['name', 'version', 'objectStoreNames'];
2929
function IDBDatabase () {
3030
this.__versionTransaction = null;
3131
this.__objectStores = null;
32+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
33+
this.__transactions = [];
3234
throw new TypeError('Illegal constructor');
3335
}
3436
const IDBDatabaseAlias = IDBDatabase;
@@ -92,6 +94,7 @@ IDBDatabase.__createInstance = function (db, name, oldVersion, version, storePro
9294
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
9395
});
9496

97+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9598
this.__transactions = [];
9699

97100
/** @type {{[key: string]: IDBObjectStore}} */
@@ -222,6 +225,7 @@ IDBDatabase.prototype.close = function () {
222225
if (this.__unblocking) {
223226
this.__unblocking.check();
224227
}
228+
this.__transactions = [];
225229
};
226230

227231
/**
@@ -325,6 +329,7 @@ IDBDatabase.prototype.__forceClose = function (msg) {
325329
'The connection was force-closed: ' + (msg || '')
326330
));
327331
});
332+
me.__transactions = [];
328333
};
329334

330335
util.defineOuterInterface(IDBDatabase.prototype, listeners);

0 commit comments

Comments
 (0)