indexeddbshim 17.3.0 → 17.3.1

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.
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v17.3.0 - 8/24/2026 */
1
+ /*! indexeddbshim - v17.3.1 - 8/24/2026 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -11472,7 +11472,22 @@
11472
11472
  // open/close the transaction's active-handler window itself.
11473
11473
  req.transaction.__handlerActive = true;
11474
11474
  req.dispatchEvent(e);
11475
- req.transaction.__handlerActive = false;
11475
+ // Give any same-tick microtask scheduled from within the
11476
+ // `upgradeneeded` handler (e.g. a plain
11477
+ // `Promise.resolve().then(...)`) a chance to run -- and still
11478
+ // observe the transaction as active -- before we deactivate it
11479
+ // again, per https://github.com/w3c/IndexedDB/issues/87. Only
11480
+ // the flag reset itself is deferred here -- unlike
11481
+ // `IDBTransaction.js`'s `advanceAfterDispatch`, `finished()`
11482
+ // (this transaction's own queue-advancement/completion signal)
11483
+ // still runs synchronously, at exactly its previous timing: an
11484
+ // earlier attempt at deferring `finished()` too raced against
11485
+ // unrelated test setup that assumed a freshly deleted/created
11486
+ // database's upgrade transaction had already fully completed by
11487
+ // the time this function returns.
11488
+ queueMicrotask(function () {
11489
+ req.transaction.__handlerActive = false;
11490
+ });
11476
11491
  if (e.__legacyOutputDidListenersThrowError) {
11477
11492
  logError('Error', 'An error occurred in an upgradeneeded handler attached to request chain', /** @type {Error} */e.__legacyOutputDidListenersThrowError); // We do nothing else with this error as per spec
11478
11493
  req.transaction.__abortTransaction(createDOMException('AbortError', 'A request was aborted.'));
@@ -13546,8 +13561,24 @@
13546
13561
  Object.setPrototypeOf(IDBRequest, EventTarget);
13547
13562
  Object.setPrototypeOf(IDBTransaction, EventTarget);
13548
13563
  Object.setPrototypeOf(IDBVersionChangeEvent, ShimEvent);
13549
- Object.setPrototypeOf(ShimDOMException, Error);
13550
- Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
13564
+ // `ShimDOMException` is the real native `DOMException` when one
13565
+ // is available (see `DOMException.js`'s `useNativeDOMException`)
13566
+ // -- which, unlike the shim classes above, is a single,
13567
+ // process-wide singleton shared by reference across every
13568
+ // sandbox this library gets installed into (see
13569
+ // `node-idb-test.js`'s `sandboxObj`). A native `DOMException`
13570
+ // already has the correct prototype chain out of the box
13571
+ // (`Object.getPrototypeOf(DOMException) === Function.prototype`,
13572
+ // not `Error`), so forcing it here isn't just unneeded but
13573
+ // actively wrong -- and, because it's shared, permanently
13574
+ // wrong for every later use of `DOMException` in the same
13575
+ // process (e.g. a later WPT test file's own idlharness-style
13576
+ // check that `DOMException` does *not* inherit from `Error`
13577
+ // on the class side), not just this one shim install.
13578
+ if (typeof DOMException === 'undefined' || ShimDOMException !== DOMException) {
13579
+ Object.setPrototypeOf(ShimDOMException, Error);
13580
+ Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
13581
+ }
13551
13582
  }
13552
13583
  if (IDB.indexedDB && !IDB.indexedDB.toString().includes('[native code]')) {
13553
13584
  if (CFG.addNonIDBGlobals) {