Skip to content

Commit ee6def9

Browse files
committed
Remove LocalStorage synchronization on storage events in Safari
1 parent 6bb2e89 commit ee6def9

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

packages/auth/src/platform_browser/persistence/local_storage.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import { Persistence } from '../../model/public_types';
1919

20-
import { getUA } from '@firebase/util';
2120
import {
2221
_isSafari,
2322
_isIOS,
@@ -33,11 +32,6 @@ import {
3332
} from '../../core/persistence';
3433
import { BrowserPersistenceClass } from './browser';
3534

36-
function _iframeCannotSyncWebStorage(): boolean {
37-
const ua = getUA();
38-
return _isSafari(ua) || _isIOS(ua);
39-
}
40-
4135
// The polling period in case events are not supported
4236
export const _POLLING_INTERVAL_MS = 1000;
4337

@@ -64,9 +58,6 @@ class BrowserLocalPersistence
6458
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6559
private pollTimer: any | null = null;
6660

67-
// Safari or iOS browser and embedded in an iframe.
68-
private readonly safariLocalStorageNotSynced =
69-
_iframeCannotSyncWebStorage() && _isIframe();
7061
// Whether to use polling instead of depending on window events
7162
private readonly fallbackToPolling = _isMobileBrowser();
7263
readonly _shouldAllowMigration = true;
@@ -112,26 +103,6 @@ class BrowserLocalPersistence
112103
this.stopPolling();
113104
}
114105

115-
// Safari embedded iframe. Storage event will trigger with the delta
116-
// changes but no changes will be applied to the iframe localStorage.
117-
if (this.safariLocalStorageNotSynced) {
118-
// Get current iframe page value.
119-
const storedValue = this.storage.getItem(key);
120-
// Value not synchronized, synchronize manually.
121-
if (event.newValue !== storedValue) {
122-
if (event.newValue !== null) {
123-
// Value changed from current value.
124-
this.storage.setItem(key, event.newValue);
125-
} else {
126-
// Current value deleted.
127-
this.storage.removeItem(key);
128-
}
129-
} else if (this.localCache[key] === event.newValue && !poll) {
130-
// Already detected and processed, do not trigger listeners again.
131-
return;
132-
}
133-
}
134-
135106
const triggerListeners = (): void => {
136107
// Keep local map up to date in case storage event is triggered before
137108
// poll.

0 commit comments

Comments
 (0)