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 +1 @@
1
- {"version":3,"file":"setGlobalVars.d.ts","sourceRoot":"","sources":["../src/setGlobalVars.js"],"names":[],"mappings":";;uBAkBa,GAAG;+BAKL,OAAO,UAAU,EAAE,iBAAiB,GAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,QAClC,QAAQ;wBAoCN,CACR,IAAI,EAAE,OAAO,UAAU,EAAE,iBAAiB,KACvC,OAAO,UAAU,EAAE,WAAW;oCAIzB,CAAC,GAAG,EAAE;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,KAAK,IAAI;4BAIA,CAAC,UAAU,GAAC,MAAM,CAAC,GAAG;IAC5B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,SAAS,CAAC;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,uBAAuB,EAAE,qBAAqB,CAAC;IAC/C,0BAA0B,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;sBAIO,MAAM;4BAIN,CAAC,OAAO,UAAU,GAAC,MAAM,CAAC,GAAG;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,WAAW,EAAE,OAAO,WAAW,CAA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,kBAAkB,CAAC;IAC9C,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;mCAhG+C,mBAAmB;AAwDtE;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,qCAJW,aAAa,kBACb,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,aAAa,CAkTzB;2BAxZ8C,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "17.3.0",
3
+ "version": "17.3.1",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
package/src/IDBFactory.js CHANGED
@@ -668,7 +668,22 @@ IDBFactory.prototype.open = function (name /* , version */) {
668
668
  // open/close the transaction's active-handler window itself.
669
669
  req.transaction.__handlerActive = true;
670
670
  req.dispatchEvent(e);
671
- req.transaction.__handlerActive = false;
671
+ // Give any same-tick microtask scheduled from within the
672
+ // `upgradeneeded` handler (e.g. a plain
673
+ // `Promise.resolve().then(...)`) a chance to run -- and still
674
+ // observe the transaction as active -- before we deactivate it
675
+ // again, per https://github.com/w3c/IndexedDB/issues/87. Only
676
+ // the flag reset itself is deferred here -- unlike
677
+ // `IDBTransaction.js`'s `advanceAfterDispatch`, `finished()`
678
+ // (this transaction's own queue-advancement/completion signal)
679
+ // still runs synchronously, at exactly its previous timing: an
680
+ // earlier attempt at deferring `finished()` too raced against
681
+ // unrelated test setup that assumed a freshly deleted/created
682
+ // database's upgrade transaction had already fully completed by
683
+ // the time this function returns.
684
+ queueMicrotask(() => {
685
+ req.transaction.__handlerActive = false;
686
+ });
672
687
 
673
688
  if (e.__legacyOutputDidListenersThrowError) {
674
689
  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
@@ -274,8 +274,24 @@ function setGlobalVars (idb, initialConfig) {
274
274
  Object.setPrototypeOf(shimIDBRequest, ShimEventTarget);
275
275
  Object.setPrototypeOf(shimIDBTransaction, ShimEventTarget);
276
276
  Object.setPrototypeOf(shimIDBVersionChangeEvent, ShimEvent);
277
- Object.setPrototypeOf(ShimDOMException, Error);
278
- Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
277
+ // `ShimDOMException` is the real native `DOMException` when one
278
+ // is available (see `DOMException.js`'s `useNativeDOMException`)
279
+ // -- which, unlike the shim classes above, is a single,
280
+ // process-wide singleton shared by reference across every
281
+ // sandbox this library gets installed into (see
282
+ // `node-idb-test.js`'s `sandboxObj`). A native `DOMException`
283
+ // already has the correct prototype chain out of the box
284
+ // (`Object.getPrototypeOf(DOMException) === Function.prototype`,
285
+ // not `Error`), so forcing it here isn't just unneeded but
286
+ // actively wrong -- and, because it's shared, permanently
287
+ // wrong for every later use of `DOMException` in the same
288
+ // process (e.g. a later WPT test file's own idlharness-style
289
+ // check that `DOMException` does *not* inherit from `Error`
290
+ // on the class side), not just this one shim install.
291
+ if (typeof DOMException === 'undefined' || ShimDOMException !== DOMException) {
292
+ Object.setPrototypeOf(ShimDOMException, Error);
293
+ Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
294
+ }
279
295
  }
280
296
  if (IDB.indexedDB && !IDB.indexedDB.toString().includes('[native code]')) {
281
297
  if (CFG.addNonIDBGlobals) {