Skip to content

Commit 7a5bc84

Browse files
authored
Skip IndexedDB cleanup on Safari 15 (#5717)
* Skip IndexedDB cleanup on Safari 15 This PR changes our IndexedDB shutdown to skip all remaining work items on Safari 15. It is believed that writing to IndexedDB during unload can trigger a bug on Safari that prevents IndexedDB from loading during the next page load. * Create lovely-bobcats-punch.md
1 parent e34e98e commit 7a5bc84

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.changeset/lovely-bobcats-punch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
The SDK no longer accesses IndexedDB during a page unload event on Safari 15. This aims to reduce the occurrence of an IndexedDB bug in Safari (https://bugs.webkit.org/show_bug.cgi?id=226547).

packages/firestore/src/local/indexeddb_persistence.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -962,10 +962,10 @@ export class IndexedDbPersistence implements Persistence {
962962
// to make sure it gets a chance to run.
963963
this.markClientZombied();
964964

965-
if (isSafari() && navigator.appVersion.match(`Version/14`)) {
966-
// On Safari 14, we do not run any cleanup actions as it might trigger
967-
// a bug that prevents Safari from re-opening IndexedDB during the
968-
// next page load.
965+
if (isSafari() && navigator.appVersion.match(/Version\/1[45]/)) {
966+
// On Safari 14 and 15, we do not run any cleanup actions as it might
967+
// trigger a bug that prevents Safari from re-opening IndexedDB during
968+
// the next page load.
969969
// See https://bugs.webkit.org/show_bug.cgi?id=226547
970970
this.queue.enterRestrictedMode(/* purgeExistingTasks= */ true);
971971
}

0 commit comments

Comments
 (0)