diff --git a/.changeset/chilled-buckets-sneeze.md b/.changeset/chilled-buckets-sneeze.md new file mode 100644 index 00000000000..d485e384f70 --- /dev/null +++ b/.changeset/chilled-buckets-sneeze.md @@ -0,0 +1,6 @@ +--- +'@firebase/firestore': patch +'firebase': patch +--- + +Check navigator.userAgent, in addition to navigator.appVersion, when determining whether to work around an IndexedDb bug in Safari. diff --git a/packages/firestore/src/local/indexeddb_persistence.ts b/packages/firestore/src/local/indexeddb_persistence.ts index 9e1857dde83..a4f70458df3 100644 --- a/packages/firestore/src/local/indexeddb_persistence.ts +++ b/packages/firestore/src/local/indexeddb_persistence.ts @@ -977,8 +977,13 @@ export class IndexedDbPersistence implements Persistence { // to make sure it gets a chance to run. this.markClientZombied(); - if (isSafari() && navigator.appVersion.match(/Version\/1[45]/)) { - // On Safari 14 and 15, we do not run any cleanup actions as it might + const safariIndexdbBugVersionRegex = /(?:Version|Mobile)\/1[456]/; + if ( + isSafari() && + (navigator.appVersion.match(safariIndexdbBugVersionRegex) || + navigator.userAgent.match(safariIndexdbBugVersionRegex)) + ) { + // On Safari 14, 15, and 16, we do not run any cleanup actions as it might // trigger a bug that prevents Safari from re-opening IndexedDB during // the next page load. // See https://bugs.webkit.org/show_bug.cgi?id=226547