idb-bridge: avoid unhandled rejection when closing DB

This commit is contained in:
Florian Dold 2021-12-15 02:58:36 +01:00
parent e84a1789af
commit f4d66541ed
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 8 additions and 6 deletions

View File

@ -562,10 +562,12 @@ export class MemoryBackend implements Backend {
throw Error("connection not found - already closed?");
}
const myDb = this.databases[myConn.dbName];
if (myDb) {
// FIXME: what if we're still in a transaction?
myDb.connectionCookies = myDb.connectionCookies.filter(
(x) => x != conn.connectionCookie,
);
}
delete this.connections[conn.connectionCookie];
this.disconnectCond.trigger();
}

View File

@ -2655,13 +2655,13 @@ export class BridgeIDBTransaction
}
}
await waitMacroQueue();
if (!request._source) {
// Special requests like indexes that just need to run some code,
// with error handling already built into operation
await operation();
} else {
await waitMacroQueue();
let event;
try {
BridgeIDBFactory.enableTracing &&