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