Skip to content

Commit 5099f0f

Browse files
authored
Use userAgent instead of depricated appVersion to check for safari indexDB bug. (#6899)
1 parent 547348b commit 5099f0f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.changeset/chilled-buckets-sneeze.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/firestore': patch
3+
'firebase': patch
4+
---
5+
6+
Check navigator.userAgent, in addition to navigator.appVersion, when determining whether to work around an IndexedDb bug in Safari.

packages/firestore/src/local/indexeddb_persistence.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,13 @@ export class IndexedDbPersistence implements Persistence {
977977
// to make sure it gets a chance to run.
978978
this.markClientZombied();
979979

980-
if (isSafari() && navigator.appVersion.match(/Version\/1[45]/)) {
981-
// On Safari 14 and 15, we do not run any cleanup actions as it might
980+
const safariIndexdbBugVersionRegex = /(?:Version|Mobile)\/1[456]/;
981+
if (
982+
isSafari() &&
983+
(navigator.appVersion.match(safariIndexdbBugVersionRegex) ||
984+
navigator.userAgent.match(safariIndexdbBugVersionRegex))
985+
) {
986+
// On Safari 14, 15, and 16, we do not run any cleanup actions as it might
982987
// trigger a bug that prevents Safari from re-opening IndexedDB during
983988
// the next page load.
984989
// See https://bugs.webkit.org/show_bug.cgi?id=226547

0 commit comments

Comments
 (0)