Skip to content

Commit 8180a2b

Browse files
authored
Fail more gracefully when opening IndexedDb fails in Firefox private browsing (#5396)
1 parent 168b87c commit 8180a2b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.changeset/brown-dog-twirl.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Improved the error handling when opening IndexedDb fails in a Firefox private browsing session.

packages/firestore/src/local/simple_db.ts

+10
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,16 @@ export class SimpleDb {
322322
'data for your app to start fresh.'
323323
)
324324
);
325+
} else if (error.name === 'InvalidStateError') {
326+
reject(
327+
new FirestoreError(
328+
Code.FAILED_PRECONDITION,
329+
'Unable to open an IndexedDB connection. This could be due to running in a ' +
330+
'private browsing session on a browser whose private browsing sessions do not ' +
331+
'support IndexedDB: ' +
332+
error
333+
)
334+
);
325335
} else {
326336
reject(new IndexedDbTransactionError(action, error));
327337
}

0 commit comments

Comments
 (0)