Skip to content

Use userAgent instead of depricated appVersion to check for safari indexDB bug. #6899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/chilled-buckets-sneeze.md
Original file line number Diff line number Diff line change
@@ -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. Add check for Mobile/# in addition to Version/# to include WKWebView safari versions in this check.
4 changes: 2 additions & 2 deletions packages/firestore/src/local/indexeddb_persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ 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
if (isSafari() && (navigator.appVersion.match(/(?:Version|Mobile)\/1[456]/) || navigator.userAgent.match(/(?:Version|Mobile)\/1[456]/))) {
// 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
Expand Down