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