indexeddbshim 17.2.0 → 17.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "17.2.0",
3
+ "version": "17.2.1",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
@@ -21,8 +21,8 @@
21
21
  "web-platform-tests/**",
22
22
  "coverage",
23
23
  "ignore",
24
- ".eslintrc.js",
25
- ".mocharc.cjs",
24
+ "eslint.config.js",
25
+ ".mocharc.js",
26
26
  "tests-mocha/**",
27
27
  "tests-polyfill/**",
28
28
  "test-support/**"
@@ -210,7 +210,6 @@
210
210
  "rollup-plugin-node-polyfills": "^0.2.1",
211
211
  "sinon": "^22.1.0",
212
212
  "source-map-support": "0.5.21",
213
- "sourcemap-transformer": "git+https://github.com/brettz9/sourcemap-transformer.git",
214
213
  "typescript": "^6.0.3",
215
214
  "w3c-blob": "0.0.1",
216
215
  "ws": "^8.21.3"
package/src/IDBFactory.js CHANGED
@@ -856,9 +856,17 @@ IDBFactory.prototype.deleteDatabase = function (name) {
856
856
  * @returns {boolean}
857
857
  */
858
858
  function dbError (tx, err) {
859
- if (calledDBError || err === true) {
859
+ if (calledDBError) {
860
860
  return false;
861
861
  }
862
+ // Must be set synchronously (not inside the `sysdbFinishedCbDelete` callback below) to
863
+ // guard against reentrancy: `sysdbFinishedCbDelete` -> `rollback`/`commit` -> websql-configurable's
864
+ // `done()` -> `currentTask.errorCallback(er)`, which is this very `dbError`, calling back into
865
+ // us before the first invocation has finished. Without this, a second rollback/commit gets
866
+ // issued on the shared `sysdb` connection after it has already moved on to the next queued
867
+ // transaction, corrupting that connection's task queue (see issue with unrelated `open()` calls
868
+ // failing/crashing after a `deleteDatabase` file-removal error).
869
+ calledDBError = true;
862
870
  const er = webSQLErrback(/** @type {SQLError} */ (err || tx));
863
871
  sysdbFinishedCbDelete(true, function () {
864
872
  req.__done = true;
@@ -867,7 +875,6 @@ IDBFactory.prototype.deleteDatabase = function (name) {
867
875
  // Re: why bubbling here (and how cancelable is only really relevant for `window.onerror`) see: https://github.com/w3c/IndexedDB/issues/86
868
876
  const e = createEvent('error', er, {bubbles: true, cancelable: true});
869
877
  req.dispatchEvent(e);
870
- calledDBError = true;
871
878
  });
872
879
  return false;
873
880
  }