diff --git a/src/profile-logic/symbol-store.js b/src/profile-logic/symbol-store.js index 4ca60b04d0..153c06c261 100644 --- a/src/profile-logic/symbol-store.js +++ b/src/profile-logic/symbol-store.js @@ -85,6 +85,10 @@ export class SymbolStore { this._db = new SymbolStoreDB(`${dbNamePrefix}-symbol-tables`); } + async closeDb() { + await this._db.close(); + } + // Store a symbol table in the database. This is only used for symbol tables // and not for partial symbol results. Symbol tables are generated by the // geckoProfiler WebExtension API, so these are symbol tables we get from the diff --git a/src/test/unit/symbol-store.test.js b/src/test/unit/symbol-store.test.js index 01eaf97d4d..d1090a4d1d 100644 --- a/src/test/unit/symbol-store.test.js +++ b/src/test/unit/symbol-store.test.js @@ -40,6 +40,9 @@ describe('SymbolStore', function() { }); afterEach(async function() { + if (symbolStore) { + await symbolStore.closeDb().catch(() => {}); + } await deleteDatabase(); }); @@ -137,12 +140,10 @@ describe('SymbolStore', function() { // Using another symbol store simulates a page reload // Due to https://github.com/dumbmatter/fakeIndexedDB/issues/22 we need to // take care to sequence the DB open requests. - const symbolStore2 = new SymbolStore( - 'perf-html-async-storage', - symbolProvider - ); + await symbolStore.closeDb().catch(() => {}); + symbolStore = new SymbolStore('perf-html-async-storage', symbolProvider); - await symbolStore2.getSymbols( + await symbolStore.getSymbols( [{ lib: lib, addresses: new Set([0x1]) }], (_request, _results) => {}, (_request, _error) => {}