diff --git a/ext/js/dictionary/dictionary-database.js b/ext/js/dictionary/dictionary-database.js index b899c1be3..2212279e9 100644 --- a/ext/js/dictionary/dictionary-database.js +++ b/ext/js/dictionary/dictionary-database.js @@ -200,6 +200,10 @@ export class DictionaryDatabase { if (this._db.isOpen()) { this._db.close(); } + if (this._worker !== null) { + this._worker.terminate(); + this._worker = null; + } let result = false; try { await Database.deleteDatabase(this._dbName); diff --git a/test/utilities/database.js b/test/utilities/database.js index 4fdf93ad0..abc749314 100644 --- a/test/utilities/database.js +++ b/test/utilities/database.js @@ -30,6 +30,7 @@ export function setupStubs() { function Worker() { return { addEventListener: () => {}, + terminate: () => {}, }; } vi.stubGlobal('Worker', Worker);