@firebase/auth 1.13.9 → 1.13.10-20261111165442
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-public.d.ts +1 -0
- package/dist/auth.d.ts +1 -0
- package/dist/browser-cjs/{index-DTUcAMkM.js → index-3quNI-5T.js} +180 -62
- package/dist/browser-cjs/index-3quNI-5T.js.map +1 -0
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/browser-cjs/src/core/persistence/index.d.ts +1 -0
- package/dist/browser-cjs/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/cordova/auth-cordova-public.d.ts +1 -0
- package/dist/cordova/auth-cordova.d.ts +1 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-xyFFcAgj.js → popup_redirect-BfyV9XtN.js} +180 -62
- package/dist/cordova/popup_redirect-BfyV9XtN.js.map +1 -0
- package/dist/cordova/src/core/persistence/index.d.ts +1 -0
- package/dist/cordova/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/esm/{index-Bz2J43nW.js → index-D7PwIQ8t.js} +180 -62
- package/dist/esm/index-D7PwIQ8t.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal.js +2 -2
- package/dist/esm/src/core/persistence/index.d.ts +1 -0
- package/dist/esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/index.webworker.js +179 -61
- package/dist/index.webworker.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal.js +1 -1
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/core/persistence/index.d.ts +1 -0
- package/dist/node/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/node/{totp-CMTC0AYP.js → totp-Cvunw6R9.js} +49 -30
- package/dist/node/totp-Cvunw6R9.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/internal.js.map +1 -1
- package/dist/node-esm/src/core/persistence/index.d.ts +1 -0
- package/dist/node-esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/node-esm/{totp-pe8Y0u5S.js → totp-BIzof36h.js} +49 -30
- package/dist/node-esm/totp-BIzof36h.js.map +1 -0
- package/dist/rn/{index-DzY9h3Kn.js → index-Cjrvemz_.js} +49 -30
- package/dist/rn/index-Cjrvemz_.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +132 -33
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/src/core/persistence/index.d.ts +1 -0
- package/dist/rn/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/src/core/persistence/index.d.ts +1 -0
- package/dist/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/web-extension-cjs/index.js +1 -1
- package/dist/web-extension-cjs/internal.js +1 -1
- package/dist/web-extension-cjs/{register-CTiLN4Sf.js → register-Bj5RraXk.js} +180 -62
- package/dist/web-extension-cjs/register-Bj5RraXk.js.map +1 -0
- package/dist/web-extension-cjs/src/core/persistence/index.d.ts +1 -0
- package/dist/web-extension-cjs/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/dist/web-extension-esm/auth-web-extension-public.d.ts +1 -0
- package/dist/web-extension-esm/auth-web-extension.d.ts +1 -0
- package/dist/web-extension-esm/index.js +2 -2
- package/dist/web-extension-esm/internal.js +2 -2
- package/dist/web-extension-esm/{register-DBjcU-NC.js → register-B2Dp0WV3.js} +180 -62
- package/dist/web-extension-esm/register-B2Dp0WV3.js.map +1 -0
- package/dist/web-extension-esm/src/core/persistence/index.d.ts +1 -0
- package/dist/web-extension-esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
- package/package.json +1 -1
- package/dist/browser-cjs/index-DTUcAMkM.js.map +0 -1
- package/dist/cordova/popup_redirect-xyFFcAgj.js.map +0 -1
- package/dist/esm/index-Bz2J43nW.js.map +0 -1
- package/dist/node/totp-CMTC0AYP.js.map +0 -1
- package/dist/node-esm/totp-pe8Y0u5S.js.map +0 -1
- package/dist/rn/index-DzY9h3Kn.js.map +0 -1
- package/dist/web-extension-cjs/register-CTiLN4Sf.js.map +0 -1
- package/dist/web-extension-esm/register-DBjcU-NC.js.map +0 -1
|
@@ -39,4 +39,5 @@ export interface PersistenceInternal extends Persistence {
|
|
|
39
39
|
_addListener(key: string, listener: StorageEventListener): void;
|
|
40
40
|
_removeListener(key: string, listener: StorageEventListener): void;
|
|
41
41
|
_shouldAllowMigration?: boolean;
|
|
42
|
+
_lastProbeTimedOut?: boolean;
|
|
42
43
|
}
|
|
@@ -17,13 +17,27 @@
|
|
|
17
17
|
import { Persistence } from '../../model/public_types';
|
|
18
18
|
import { PersistenceValue } from '../../core/persistence/';
|
|
19
19
|
export declare const DB_NAME = "firebaseLocalStorageDb";
|
|
20
|
+
export declare const _POLLING_INTERVAL_MS = 800;
|
|
21
|
+
export declare const _TRANSACTION_RETRY_COUNT = 3;
|
|
22
|
+
/**
|
|
23
|
+
* Short timeout scoped to the `readwrite` availability probe in `_isAvailable()`.
|
|
24
|
+
* Matches `_POLLING_INTERVAL_MS` so that if a background tab is suspended while
|
|
25
|
+
* holding a `readonly` poll transaction that blocks `readwrite` transactions
|
|
26
|
+
* (#10540), the startup probe fails fast and aborts its queued transaction in
|
|
27
|
+
* under a second without blocking fallback or user loading.
|
|
28
|
+
*/
|
|
29
|
+
export declare const _DB_PROBE_TIMEOUT_MS = 800;
|
|
30
|
+
/**
|
|
31
|
+
* Timeout for opening the database and regular IndexedDB read/write requests.
|
|
32
|
+
* Kept at multiple seconds to accommodate cold `indexedDB.open()` or slow disk
|
|
33
|
+
* I/O on low-end devices without premature timeouts.
|
|
34
|
+
*/
|
|
35
|
+
export declare const _DB_TIMEOUT_MS = 2500;
|
|
20
36
|
export declare function _clearDatabase(db: IDBDatabase): Promise<void>;
|
|
21
37
|
export declare function _deleteDatabase(): Promise<void>;
|
|
22
38
|
export declare function _openDatabase(): Promise<IDBDatabase>;
|
|
23
|
-
export declare function _putObject(db: IDBDatabase, key: string, value: PersistenceValue | string): Promise<void>;
|
|
24
|
-
export declare function _deleteObject(db: IDBDatabase, key: string): Promise<void>;
|
|
25
|
-
export declare const _POLLING_INTERVAL_MS = 800;
|
|
26
|
-
export declare const _TRANSACTION_RETRY_COUNT = 3;
|
|
39
|
+
export declare function _putObject(db: IDBDatabase, key: string, value: PersistenceValue | string, timeoutMs?: number): Promise<void>;
|
|
40
|
+
export declare function _deleteObject(db: IDBDatabase, key: string, timeoutMs?: number): Promise<void>;
|
|
27
41
|
/**
|
|
28
42
|
* An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
|
|
29
43
|
* for the underlying storage.
|
|
@@ -2198,6 +2198,7 @@ declare interface PersistenceInternal extends Persistence {
|
|
|
2198
2198
|
_addListener(key: string, listener: StorageEventListener): void;
|
|
2199
2199
|
_removeListener(key: string, listener: StorageEventListener): void;
|
|
2200
2200
|
_shouldAllowMigration?: boolean;
|
|
2201
|
+
_lastProbeTimedOut?: boolean;
|
|
2201
2202
|
}
|
|
2202
2203
|
|
|
2203
2204
|
declare const enum PersistenceType {
|
|
@@ -2597,6 +2597,7 @@ declare interface PersistenceInternal extends Persistence {
|
|
|
2597
2597
|
_addListener(key: string, listener: StorageEventListener): void;
|
|
2598
2598
|
_removeListener(key: string, listener: StorageEventListener): void;
|
|
2599
2599
|
_shouldAllowMigration?: boolean;
|
|
2600
|
+
_lastProbeTimedOut?: boolean;
|
|
2600
2601
|
}
|
|
2601
2602
|
|
|
2602
2603
|
declare const enum PersistenceType {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerAuth, i as initializeAuth, c as connectAuthEmulator, a as indexedDBLocalPersistence } from './register-
|
|
2
|
-
export { A as ActionCodeURL, b as AuthCredential, d as AuthErrorCodes, E as EmailAuthCredential, e as EmailAuthProvider, F as FacebookAuthProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, h as TotpSecret, j as TwitterAuthProvider, k as applyActionCode, l as beforeAuthStateChanged, m as checkActionCode, n as confirmPasswordReset, o as createUserWithEmailAndPassword, p as debugErrorMap, q as deleteUser, s as fetchSignInMethodsForEmail, t as getAdditionalUserInfo, u as getIdToken, v as getIdTokenResult, w as getMultiFactorResolver, x as inMemoryPersistence, y as initializeRecaptchaConfig, z as isSignInWithEmailLink, B as linkWithCredential, C as multiFactor, D as onAuthStateChanged, H as onIdTokenChanged, I as parseActionCodeURL, J as prodErrorMap, K as reauthenticateWithCredential, L as reload, M as revokeAccessToken, N as sendEmailVerification, Q as sendPasswordResetEmail, R as sendSignInLinkToEmail, U as setPersistence, V as signInAnonymously, W as signInWithCredential, X as signInWithCustomToken, Y as signInWithEmailAndPassword, Z as signInWithEmailLink, _ as signOut, $ as unlink, a0 as updateCurrentUser, a1 as updateEmail, a2 as updatePassword, a3 as updateProfile, a4 as useDeviceLanguage, a5 as validatePassword, a6 as verifyBeforeUpdateEmail, a7 as verifyPasswordResetCode } from './register-
|
|
1
|
+
import { r as registerAuth, i as initializeAuth, c as connectAuthEmulator, a as indexedDBLocalPersistence } from './register-B2Dp0WV3.js';
|
|
2
|
+
export { A as ActionCodeURL, b as AuthCredential, d as AuthErrorCodes, E as EmailAuthCredential, e as EmailAuthProvider, F as FacebookAuthProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, h as TotpSecret, j as TwitterAuthProvider, k as applyActionCode, l as beforeAuthStateChanged, m as checkActionCode, n as confirmPasswordReset, o as createUserWithEmailAndPassword, p as debugErrorMap, q as deleteUser, s as fetchSignInMethodsForEmail, t as getAdditionalUserInfo, u as getIdToken, v as getIdTokenResult, w as getMultiFactorResolver, x as inMemoryPersistence, y as initializeRecaptchaConfig, z as isSignInWithEmailLink, B as linkWithCredential, C as multiFactor, D as onAuthStateChanged, H as onIdTokenChanged, I as parseActionCodeURL, J as prodErrorMap, K as reauthenticateWithCredential, L as reload, M as revokeAccessToken, N as sendEmailVerification, Q as sendPasswordResetEmail, R as sendSignInLinkToEmail, U as setPersistence, V as signInAnonymously, W as signInWithCredential, X as signInWithCustomToken, Y as signInWithEmailAndPassword, Z as signInWithEmailLink, _ as signOut, $ as unlink, a0 as updateCurrentUser, a1 as updateEmail, a2 as updatePassword, a3 as updateProfile, a4 as useDeviceLanguage, a5 as validatePassword, a6 as verifyBeforeUpdateEmail, a7 as verifyPasswordResetCode } from './register-B2Dp0WV3.js';
|
|
3
3
|
import { _getProvider, getApp } from '@firebase/app';
|
|
4
4
|
import { getDefaultEmulatorHost } from '@firebase/util';
|
|
5
5
|
import '@firebase/component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isMobileBrowser, aa as _isIE10, ab as Delay, ac as MockReCaptcha, ad as _window, ae as _assert, af as isV2, ag as _createError, ah as _recaptchaV2ScriptUrl, ai as _loadJS, aj as _generateCallbackName, ak as _castAuth, al as _isHttpOrHttps, am as _isWorker, an as getRecaptchaParams, ao as _assertLinkedStatus, B as linkWithCredential, ap as _serverAppCurrentUserOperationNotSupportedError, K as reauthenticateWithCredential, W as signInWithCredential, aq as _link$1, ar as _initializeRecaptchaConfig, as as FAKE_TOKEN, at as startEnrollPhoneMfa, au as handleRecaptchaFlow, av as startSignInPhoneMfa, aw as sendPhoneVerificationCode, P as PhoneAuthCredential, ax as _getInstance, ay as _reauthenticate, az as _signInWithCredential, b as AuthCredential, aA as signInWithIdp, aB as _fail, aC as debugAssert, aD as _assertInstanceOf, aE as _generateEventId, aF as FederatedAuthProvider, aG as _persistenceKeyName, aH as _performApiRequest, aI as _getCurrentUrl, aJ as _gapiScriptUrl, aK as _emulatorUrl, aL as _isChromeIOS, aM as _isFirefox, aN as _isIOSStandalone, aO as BaseOAuthProvider, aP as _setWindowLocation, aQ as _isSafari, aR as _isIOS, aS as MultiFactorAssertionImpl, aT as finalizeEnrollPhoneMfa, aU as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, l as beforeAuthStateChanged, H as onIdTokenChanged, c as connectAuthEmulator, aV as _setExternalJSProvider, aW as _isAndroid, aX as _isIOS7Or8 } from './register-
|
|
2
|
-
export { A as ActionCodeURL, d as AuthErrorCodes, aY as AuthImpl, E as EmailAuthCredential, e as EmailAuthProvider, F as FacebookAuthProvider, aZ as FetchProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, a_ as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, h as TotpSecret, j as TwitterAuthProvider, a$ as UserImpl, b0 as _getClientVersion, k as applyActionCode, m as checkActionCode, n as confirmPasswordReset, o as createUserWithEmailAndPassword, p as debugErrorMap, q as deleteUser, s as fetchSignInMethodsForEmail, t as getAdditionalUserInfo, u as getIdToken, v as getIdTokenResult, w as getMultiFactorResolver, x as inMemoryPersistence, y as initializeRecaptchaConfig, z as isSignInWithEmailLink, C as multiFactor, D as onAuthStateChanged, I as parseActionCodeURL, J as prodErrorMap, L as reload, M as revokeAccessToken, N as sendEmailVerification, Q as sendPasswordResetEmail, R as sendSignInLinkToEmail, U as setPersistence, V as signInAnonymously, X as signInWithCustomToken, Y as signInWithEmailAndPassword, Z as signInWithEmailLink, _ as signOut, $ as unlink, a0 as updateCurrentUser, a1 as updateEmail, a2 as updatePassword, a3 as updateProfile, a4 as useDeviceLanguage, a5 as validatePassword, a6 as verifyBeforeUpdateEmail, a7 as verifyPasswordResetCode } from './register-
|
|
1
|
+
import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isMobileBrowser, aa as _isIE10, ab as Delay, ac as MockReCaptcha, ad as _window, ae as _assert, af as isV2, ag as _createError, ah as _recaptchaV2ScriptUrl, ai as _loadJS, aj as _generateCallbackName, ak as _castAuth, al as _isHttpOrHttps, am as _isWorker, an as getRecaptchaParams, ao as _assertLinkedStatus, B as linkWithCredential, ap as _serverAppCurrentUserOperationNotSupportedError, K as reauthenticateWithCredential, W as signInWithCredential, aq as _link$1, ar as _initializeRecaptchaConfig, as as FAKE_TOKEN, at as startEnrollPhoneMfa, au as handleRecaptchaFlow, av as startSignInPhoneMfa, aw as sendPhoneVerificationCode, P as PhoneAuthCredential, ax as _getInstance, ay as _reauthenticate, az as _signInWithCredential, b as AuthCredential, aA as signInWithIdp, aB as _fail, aC as debugAssert, aD as _assertInstanceOf, aE as _generateEventId, aF as FederatedAuthProvider, aG as _persistenceKeyName, aH as _performApiRequest, aI as _getCurrentUrl, aJ as _gapiScriptUrl, aK as _emulatorUrl, aL as _isChromeIOS, aM as _isFirefox, aN as _isIOSStandalone, aO as BaseOAuthProvider, aP as _setWindowLocation, aQ as _isSafari, aR as _isIOS, aS as MultiFactorAssertionImpl, aT as finalizeEnrollPhoneMfa, aU as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, l as beforeAuthStateChanged, H as onIdTokenChanged, c as connectAuthEmulator, aV as _setExternalJSProvider, aW as _isAndroid, aX as _isIOS7Or8 } from './register-B2Dp0WV3.js';
|
|
2
|
+
export { A as ActionCodeURL, d as AuthErrorCodes, aY as AuthImpl, E as EmailAuthCredential, e as EmailAuthProvider, F as FacebookAuthProvider, aZ as FetchProvider, G as GithubAuthProvider, f as GoogleAuthProvider, O as OAuthCredential, g as OAuthProvider, a_ as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, h as TotpSecret, j as TwitterAuthProvider, a$ as UserImpl, b0 as _getClientVersion, k as applyActionCode, m as checkActionCode, n as confirmPasswordReset, o as createUserWithEmailAndPassword, p as debugErrorMap, q as deleteUser, s as fetchSignInMethodsForEmail, t as getAdditionalUserInfo, u as getIdToken, v as getIdTokenResult, w as getMultiFactorResolver, x as inMemoryPersistence, y as initializeRecaptchaConfig, z as isSignInWithEmailLink, C as multiFactor, D as onAuthStateChanged, I as parseActionCodeURL, J as prodErrorMap, L as reload, M as revokeAccessToken, N as sendEmailVerification, Q as sendPasswordResetEmail, R as sendSignInLinkToEmail, U as setPersistence, V as signInAnonymously, X as signInWithCustomToken, Y as signInWithEmailAndPassword, Z as signInWithEmailLink, _ as signOut, $ as unlink, a0 as updateCurrentUser, a1 as updateEmail, a2 as updatePassword, a3 as updateProfile, a4 as useDeviceLanguage, a5 as validatePassword, a6 as verifyBeforeUpdateEmail, a7 as verifyPasswordResetCode } from './register-B2Dp0WV3.js';
|
|
3
3
|
import { querystring, getModularInstance, getUA, isEmpty, getExperimentalSetting, getDefaultEmulatorHost, querystringDecode } from '@firebase/util';
|
|
4
4
|
import { _isFirebaseServerApp, SDK_VERSION, _getProvider, getApp } from '@firebase/app';
|
|
5
5
|
import '@firebase/component';
|
|
@@ -2044,31 +2044,25 @@ class PersistenceUserManager {
|
|
|
2044
2044
|
if (!persistenceHierarchy.length) {
|
|
2045
2045
|
return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);
|
|
2046
2046
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2047
|
+
const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);
|
|
2048
|
+
// Search for an existing user across all persistences before running `_isAvailable()`.
|
|
2049
|
+
// `_get` only opens a `readonly` transaction in IndexedDB, whereas `_isAvailable()` opens
|
|
2050
|
+
// a `readwrite` transaction; if another tab is suspended holding a `readonly` transaction
|
|
2051
|
+
// (#10540), queuing a `readwrite` transaction first blocks subsequent `readonly` transactions
|
|
2052
|
+
// in the browser's IndexedDB lock manager.
|
|
2053
|
+
let foundUser = null;
|
|
2054
|
+
let foundPersistence = null;
|
|
2055
|
+
const unreadablePersistences = new Set();
|
|
2056
|
+
for (const persistence of persistenceHierarchy) {
|
|
2057
|
+
let blob = null;
|
|
2049
2058
|
try {
|
|
2050
|
-
|
|
2051
|
-
return persistence;
|
|
2052
|
-
}
|
|
2059
|
+
blob = await persistence._get(key);
|
|
2053
2060
|
}
|
|
2054
2061
|
catch {
|
|
2055
|
-
|
|
2062
|
+
unreadablePersistences.add(persistence);
|
|
2063
|
+
continue;
|
|
2056
2064
|
}
|
|
2057
|
-
return undefined;
|
|
2058
|
-
}))).filter(persistence => persistence);
|
|
2059
|
-
// Fall back to the first persistence listed, or in memory if none available
|
|
2060
|
-
let selectedPersistence = availablePersistences[0] ||
|
|
2061
|
-
_getInstance(inMemoryPersistence);
|
|
2062
|
-
const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);
|
|
2063
|
-
// Pull out the existing user, setting the chosen persistence to that
|
|
2064
|
-
// persistence if the user exists.
|
|
2065
|
-
let userToMigrate = null;
|
|
2066
|
-
// Note, here we check for a user in _all_ persistences, not just the
|
|
2067
|
-
// ones deemed available. If we can migrate a user out of a broken
|
|
2068
|
-
// persistence, we will (but only if that persistence supports migration).
|
|
2069
|
-
for (const persistence of persistenceHierarchy) {
|
|
2070
2065
|
try {
|
|
2071
|
-
const blob = await persistence._get(key);
|
|
2072
2066
|
if (blob) {
|
|
2073
2067
|
let user;
|
|
2074
2068
|
if (typeof blob === 'string') {
|
|
@@ -2083,15 +2077,38 @@ class PersistenceUserManager {
|
|
|
2083
2077
|
else {
|
|
2084
2078
|
user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
|
|
2085
2079
|
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
}
|
|
2089
|
-
selectedPersistence = persistence;
|
|
2080
|
+
foundUser = user;
|
|
2081
|
+
foundPersistence = persistence;
|
|
2090
2082
|
break;
|
|
2091
2083
|
}
|
|
2092
2084
|
}
|
|
2093
2085
|
catch { }
|
|
2094
2086
|
}
|
|
2087
|
+
// Eliminate any persistences that are not available
|
|
2088
|
+
const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {
|
|
2089
|
+
try {
|
|
2090
|
+
if (await persistence._isAvailable()) {
|
|
2091
|
+
return persistence;
|
|
2092
|
+
}
|
|
2093
|
+
if (persistence._lastProbeTimedOut) {
|
|
2094
|
+
unreadablePersistences.add(persistence);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
catch {
|
|
2098
|
+
return undefined;
|
|
2099
|
+
}
|
|
2100
|
+
return undefined;
|
|
2101
|
+
}))).filter(persistence => persistence);
|
|
2102
|
+
// Fall back to the first persistence listed, or in memory if none available
|
|
2103
|
+
let selectedPersistence = availablePersistences[0] ||
|
|
2104
|
+
_getInstance(inMemoryPersistence);
|
|
2105
|
+
let userToMigrate = null;
|
|
2106
|
+
if (foundPersistence && foundUser) {
|
|
2107
|
+
if (foundPersistence !== selectedPersistence) {
|
|
2108
|
+
userToMigrate = foundUser;
|
|
2109
|
+
}
|
|
2110
|
+
selectedPersistence = foundPersistence;
|
|
2111
|
+
}
|
|
2095
2112
|
// If we find the user in a persistence that does support migration, use
|
|
2096
2113
|
// that migration path (of only persistences that support migration)
|
|
2097
2114
|
const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration);
|
|
@@ -2106,10 +2123,13 @@ class PersistenceUserManager {
|
|
|
2106
2123
|
// we'll just let it bubble to surface the error.
|
|
2107
2124
|
await selectedPersistence._set(key, userToMigrate.toJSON());
|
|
2108
2125
|
}
|
|
2109
|
-
// Attempt to clear the key in other persistences
|
|
2110
|
-
//
|
|
2126
|
+
// Attempt to clear the key in other persistences (except those whose _get threw or whose
|
|
2127
|
+
// _isAvailable() probe timed out, so we never delete from a store we couldn't read or that
|
|
2128
|
+
// is blocked by another tab) and ignore errors. This helps prevent issues such as users
|
|
2129
|
+
// getting stuck with a previous account after signing out and refreshing the tab.
|
|
2111
2130
|
await Promise.all(persistenceHierarchy.map(async (persistence) => {
|
|
2112
|
-
if (persistence !== selectedPersistence
|
|
2131
|
+
if (persistence !== selectedPersistence &&
|
|
2132
|
+
!unreadablePersistences.has(persistence)) {
|
|
2113
2133
|
try {
|
|
2114
2134
|
await persistence._remove(key);
|
|
2115
2135
|
}
|
|
@@ -2631,7 +2651,6 @@ class AuthImpl {
|
|
|
2631
2651
|
}
|
|
2632
2652
|
catch (e) {
|
|
2633
2653
|
_logWarn(`Failed to initialize current user: ${e}`);
|
|
2634
|
-
await this.directlySetCurrentUser(null).catch(() => { });
|
|
2635
2654
|
}
|
|
2636
2655
|
this.lastNotifiedUid = this.currentUser?.uid || null;
|
|
2637
2656
|
if (this._deleted) {
|
|
@@ -7703,6 +7722,23 @@ const DB_NAME = 'firebaseLocalStorageDb';
|
|
|
7703
7722
|
const DB_VERSION = 1;
|
|
7704
7723
|
const DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';
|
|
7705
7724
|
const DB_DATA_KEYPATH = 'fbase_key';
|
|
7725
|
+
const _POLLING_INTERVAL_MS = 800;
|
|
7726
|
+
const _TRANSACTION_RETRY_COUNT = 3;
|
|
7727
|
+
/**
|
|
7728
|
+
* Short timeout scoped to the `readwrite` availability probe in `_isAvailable()`.
|
|
7729
|
+
* Matches `_POLLING_INTERVAL_MS` so that if a background tab is suspended while
|
|
7730
|
+
* holding a `readonly` poll transaction that blocks `readwrite` transactions
|
|
7731
|
+
* (#10540), the startup probe fails fast and aborts its queued transaction in
|
|
7732
|
+
* under a second without blocking fallback or user loading.
|
|
7733
|
+
*/
|
|
7734
|
+
const _DB_PROBE_TIMEOUT_MS = 800;
|
|
7735
|
+
/**
|
|
7736
|
+
* Timeout for opening the database and regular IndexedDB read/write requests.
|
|
7737
|
+
* Kept at multiple seconds to accommodate cold `indexedDB.open()` or slow disk
|
|
7738
|
+
* I/O on low-end devices without premature timeouts.
|
|
7739
|
+
*/
|
|
7740
|
+
const _DB_TIMEOUT_MS = 2500;
|
|
7741
|
+
const DB_TIMEOUT_ERROR = 'DB_TIMEOUT';
|
|
7706
7742
|
/**
|
|
7707
7743
|
* Promise wrapper for IDBRequest
|
|
7708
7744
|
*
|
|
@@ -7713,13 +7749,32 @@ class DBPromise {
|
|
|
7713
7749
|
constructor(request) {
|
|
7714
7750
|
this.request = request;
|
|
7715
7751
|
}
|
|
7716
|
-
toPromise() {
|
|
7752
|
+
toPromise(timeoutMs = _DB_TIMEOUT_MS) {
|
|
7717
7753
|
return new Promise((resolve, reject) => {
|
|
7754
|
+
let settled = false;
|
|
7755
|
+
const timer = setTimeout(() => {
|
|
7756
|
+
if (!settled) {
|
|
7757
|
+
settled = true;
|
|
7758
|
+
try {
|
|
7759
|
+
this.request.transaction?.abort();
|
|
7760
|
+
}
|
|
7761
|
+
catch { }
|
|
7762
|
+
reject(new Error(DB_TIMEOUT_ERROR));
|
|
7763
|
+
}
|
|
7764
|
+
}, timeoutMs);
|
|
7718
7765
|
this.request.addEventListener('success', () => {
|
|
7719
|
-
|
|
7766
|
+
if (!settled) {
|
|
7767
|
+
settled = true;
|
|
7768
|
+
clearTimeout(timer);
|
|
7769
|
+
resolve(this.request.result);
|
|
7770
|
+
}
|
|
7720
7771
|
});
|
|
7721
7772
|
this.request.addEventListener('error', () => {
|
|
7722
|
-
|
|
7773
|
+
if (!settled) {
|
|
7774
|
+
settled = true;
|
|
7775
|
+
clearTimeout(timer);
|
|
7776
|
+
reject(this.request.error);
|
|
7777
|
+
}
|
|
7723
7778
|
});
|
|
7724
7779
|
});
|
|
7725
7780
|
}
|
|
@@ -7736,8 +7791,19 @@ function _deleteDatabase() {
|
|
|
7736
7791
|
function _openDatabase() {
|
|
7737
7792
|
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
7738
7793
|
return new Promise((resolve, reject) => {
|
|
7794
|
+
let settled = false;
|
|
7795
|
+
const timer = setTimeout(() => {
|
|
7796
|
+
if (!settled) {
|
|
7797
|
+
settled = true;
|
|
7798
|
+
reject(new Error(DB_TIMEOUT_ERROR));
|
|
7799
|
+
}
|
|
7800
|
+
}, _DB_TIMEOUT_MS);
|
|
7739
7801
|
request.addEventListener('error', () => {
|
|
7740
|
-
|
|
7802
|
+
if (!settled) {
|
|
7803
|
+
settled = true;
|
|
7804
|
+
clearTimeout(timer);
|
|
7805
|
+
reject(request.error);
|
|
7806
|
+
}
|
|
7741
7807
|
});
|
|
7742
7808
|
request.addEventListener('upgradeneeded', () => {
|
|
7743
7809
|
const db = request.result;
|
|
@@ -7745,11 +7811,20 @@ function _openDatabase() {
|
|
|
7745
7811
|
db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH });
|
|
7746
7812
|
}
|
|
7747
7813
|
catch (e) {
|
|
7748
|
-
|
|
7814
|
+
if (!settled) {
|
|
7815
|
+
settled = true;
|
|
7816
|
+
clearTimeout(timer);
|
|
7817
|
+
reject(e);
|
|
7818
|
+
}
|
|
7749
7819
|
}
|
|
7750
7820
|
});
|
|
7751
7821
|
request.addEventListener('success', async () => {
|
|
7752
7822
|
const db = request.result;
|
|
7823
|
+
if (settled) {
|
|
7824
|
+
db.close();
|
|
7825
|
+
return;
|
|
7826
|
+
}
|
|
7827
|
+
clearTimeout(timer);
|
|
7753
7828
|
// Strange bug that occurs in Firefox when multiple tabs are opened at the
|
|
7754
7829
|
// same time. The only way to recover seems to be deleting the database
|
|
7755
7830
|
// and re-initializing it.
|
|
@@ -7757,33 +7832,45 @@ function _openDatabase() {
|
|
|
7757
7832
|
if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {
|
|
7758
7833
|
// Need to close the database or else you get a `blocked` event
|
|
7759
7834
|
db.close();
|
|
7760
|
-
|
|
7761
|
-
|
|
7835
|
+
try {
|
|
7836
|
+
// Note: if `deleteDatabase` is `blocked` by another tab's open connection and
|
|
7837
|
+
// times out (`DB_TIMEOUT_ERROR`), `request.transaction` is null so the browser
|
|
7838
|
+
// keeps the delete request queued until all blocking connections close.
|
|
7839
|
+
await _deleteDatabase();
|
|
7840
|
+
const reopenedDb = await _openDatabase();
|
|
7841
|
+
settled = true;
|
|
7842
|
+
resolve(reopenedDb);
|
|
7843
|
+
}
|
|
7844
|
+
catch (e) {
|
|
7845
|
+
if (!settled) {
|
|
7846
|
+
settled = true;
|
|
7847
|
+
reject(e);
|
|
7848
|
+
}
|
|
7849
|
+
}
|
|
7762
7850
|
}
|
|
7763
7851
|
else {
|
|
7852
|
+
settled = true;
|
|
7764
7853
|
resolve(db);
|
|
7765
7854
|
}
|
|
7766
7855
|
});
|
|
7767
7856
|
});
|
|
7768
7857
|
}
|
|
7769
|
-
async function _putObject(db, key, value) {
|
|
7858
|
+
async function _putObject(db, key, value, timeoutMs = _DB_TIMEOUT_MS) {
|
|
7770
7859
|
const request = getObjectStore(db, true).put({
|
|
7771
7860
|
[DB_DATA_KEYPATH]: key,
|
|
7772
7861
|
value
|
|
7773
7862
|
});
|
|
7774
|
-
return new DBPromise(request).toPromise();
|
|
7863
|
+
return new DBPromise(request).toPromise(timeoutMs);
|
|
7775
7864
|
}
|
|
7776
7865
|
async function getObject(db, key) {
|
|
7777
7866
|
const request = getObjectStore(db, false).get(key);
|
|
7778
7867
|
const data = await new DBPromise(request).toPromise();
|
|
7779
7868
|
return data === undefined ? null : data.value;
|
|
7780
7869
|
}
|
|
7781
|
-
function _deleteObject(db, key) {
|
|
7870
|
+
function _deleteObject(db, key, timeoutMs = _DB_TIMEOUT_MS) {
|
|
7782
7871
|
const request = getObjectStore(db, true).delete(key);
|
|
7783
|
-
return new DBPromise(request).toPromise();
|
|
7872
|
+
return new DBPromise(request).toPromise(timeoutMs);
|
|
7784
7873
|
}
|
|
7785
|
-
const _POLLING_INTERVAL_MS = 800;
|
|
7786
|
-
const _TRANSACTION_RETRY_COUNT = 3;
|
|
7787
7874
|
class IndexedDBLocalPersistence {
|
|
7788
7875
|
registerLifecycleListeners() {
|
|
7789
7876
|
if (typeof window !== 'undefined' &&
|
|
@@ -7810,6 +7897,7 @@ class IndexedDBLocalPersistence {
|
|
|
7810
7897
|
this.pollTimer = null;
|
|
7811
7898
|
this.isClosing = false;
|
|
7812
7899
|
this.pendingWrites = 0;
|
|
7900
|
+
this._lastProbeTimedOut = false;
|
|
7813
7901
|
this.receiver = null;
|
|
7814
7902
|
this.sender = null;
|
|
7815
7903
|
this.serviceWorkerReceiverAvailable = false;
|
|
@@ -7838,32 +7926,46 @@ class IndexedDBLocalPersistence {
|
|
|
7838
7926
|
if (this.dbPromise) {
|
|
7839
7927
|
return this.dbPromise;
|
|
7840
7928
|
}
|
|
7841
|
-
|
|
7842
|
-
this.dbPromise
|
|
7843
|
-
|
|
7929
|
+
const dbPromise = _openDatabase();
|
|
7930
|
+
this.dbPromise = dbPromise;
|
|
7931
|
+
dbPromise.catch(() => {
|
|
7932
|
+
if (this.dbPromise === dbPromise) {
|
|
7933
|
+
this.dbPromise = null;
|
|
7934
|
+
}
|
|
7844
7935
|
});
|
|
7845
|
-
return
|
|
7936
|
+
return dbPromise;
|
|
7846
7937
|
}
|
|
7847
7938
|
async _withRetries(op) {
|
|
7848
7939
|
let numAttempts = 0;
|
|
7849
7940
|
while (true) {
|
|
7941
|
+
let db;
|
|
7942
|
+
let dbPromiseBeforeOp = null;
|
|
7850
7943
|
try {
|
|
7851
|
-
const
|
|
7944
|
+
const openPromise = this._openDb();
|
|
7945
|
+
dbPromiseBeforeOp = this.dbPromise;
|
|
7946
|
+
db = await openPromise;
|
|
7852
7947
|
return await op(db);
|
|
7853
7948
|
}
|
|
7854
7949
|
catch (e) {
|
|
7855
|
-
if (
|
|
7856
|
-
|
|
7950
|
+
if (db) {
|
|
7951
|
+
db.close();
|
|
7952
|
+
if (dbPromiseBeforeOp && this.dbPromise === dbPromiseBeforeOp) {
|
|
7953
|
+
this.dbPromise = null;
|
|
7954
|
+
}
|
|
7857
7955
|
}
|
|
7858
|
-
if (this.dbPromise) {
|
|
7859
|
-
const
|
|
7956
|
+
else if (this.dbPromise && this.dbPromise === dbPromiseBeforeOp) {
|
|
7957
|
+
const currentDbPromise = this.dbPromise;
|
|
7860
7958
|
this.dbPromise = null;
|
|
7861
7959
|
try {
|
|
7862
|
-
const
|
|
7863
|
-
|
|
7960
|
+
const openedDb = await currentDbPromise;
|
|
7961
|
+
openedDb.close();
|
|
7864
7962
|
}
|
|
7865
7963
|
catch { }
|
|
7866
7964
|
}
|
|
7965
|
+
const isTimeout = e instanceof Error && e.message === DB_TIMEOUT_ERROR;
|
|
7966
|
+
if (isTimeout || numAttempts++ > _TRANSACTION_RETRY_COUNT) {
|
|
7967
|
+
throw e;
|
|
7968
|
+
}
|
|
7867
7969
|
// TODO: consider adding exponential backoff
|
|
7868
7970
|
}
|
|
7869
7971
|
}
|
|
@@ -7943,17 +8045,21 @@ class IndexedDBLocalPersistence {
|
|
|
7943
8045
|
}
|
|
7944
8046
|
}
|
|
7945
8047
|
async _isAvailable() {
|
|
8048
|
+
this._lastProbeTimedOut = false;
|
|
7946
8049
|
try {
|
|
7947
8050
|
if (!indexedDB) {
|
|
7948
8051
|
return false;
|
|
7949
8052
|
}
|
|
7950
8053
|
await this._withRetries(async (db) => {
|
|
7951
|
-
await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
|
|
7952
|
-
await _deleteObject(db, STORAGE_AVAILABLE_KEY);
|
|
8054
|
+
await _putObject(db, STORAGE_AVAILABLE_KEY, '1', _DB_PROBE_TIMEOUT_MS);
|
|
8055
|
+
await _deleteObject(db, STORAGE_AVAILABLE_KEY, _DB_PROBE_TIMEOUT_MS);
|
|
7953
8056
|
});
|
|
7954
8057
|
return true;
|
|
7955
8058
|
}
|
|
7956
|
-
catch {
|
|
8059
|
+
catch (e) {
|
|
8060
|
+
this._lastProbeTimedOut =
|
|
8061
|
+
e instanceof Error && e.message === DB_TIMEOUT_ERROR;
|
|
8062
|
+
}
|
|
7957
8063
|
return false;
|
|
7958
8064
|
}
|
|
7959
8065
|
async _withPendingWrite(write) {
|
|
@@ -7973,9 +8079,19 @@ class IndexedDBLocalPersistence {
|
|
|
7973
8079
|
});
|
|
7974
8080
|
}
|
|
7975
8081
|
async _get(key) {
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
8082
|
+
try {
|
|
8083
|
+
const obj = (await this._withRetries((db) => getObject(db, key)));
|
|
8084
|
+
this.localCache[key] = obj;
|
|
8085
|
+
return obj;
|
|
8086
|
+
}
|
|
8087
|
+
catch (e) {
|
|
8088
|
+
if (e instanceof Error &&
|
|
8089
|
+
e.message === DB_TIMEOUT_ERROR &&
|
|
8090
|
+
this.localCache[key] != null) {
|
|
8091
|
+
return this.localCache[key];
|
|
8092
|
+
}
|
|
8093
|
+
throw e;
|
|
8094
|
+
}
|
|
7979
8095
|
}
|
|
7980
8096
|
async _remove(key) {
|
|
7981
8097
|
return this._withPendingWrite(async () => {
|
|
@@ -8057,8 +8173,10 @@ class IndexedDBLocalPersistence {
|
|
|
8057
8173
|
}
|
|
8058
8174
|
if (!this.listeners[key]) {
|
|
8059
8175
|
this.listeners[key] = new Set();
|
|
8060
|
-
|
|
8061
|
-
|
|
8176
|
+
if (!(key in this.localCache)) {
|
|
8177
|
+
// Populate the cache to avoid spuriously triggering on first poll.
|
|
8178
|
+
void this._get(key).catch(() => { }); // This can happen in the background async and we can return immediately.
|
|
8179
|
+
}
|
|
8062
8180
|
}
|
|
8063
8181
|
this.listeners[key].add(listener);
|
|
8064
8182
|
}
|
|
@@ -8273,7 +8391,7 @@ function _isEmptyString(input) {
|
|
|
8273
8391
|
}
|
|
8274
8392
|
|
|
8275
8393
|
var name = "@firebase/auth";
|
|
8276
|
-
var version = "1.13.
|
|
8394
|
+
var version = "1.13.10-20261111165442";
|
|
8277
8395
|
|
|
8278
8396
|
/**
|
|
8279
8397
|
* @license
|
|
@@ -8419,4 +8537,4 @@ function registerAuth(clientPlatform) {
|
|
|
8419
8537
|
}
|
|
8420
8538
|
|
|
8421
8539
|
export { unlink as $, ActionCodeURL as A, linkWithCredential as B, multiFactor as C, onAuthStateChanged as D, EmailAuthCredential as E, FacebookAuthProvider as F, GithubAuthProvider as G, onIdTokenChanged as H, parseActionCodeURL as I, prodErrorMap as J, reauthenticateWithCredential as K, reload as L, revokeAccessToken as M, sendEmailVerification as N, OAuthCredential as O, PhoneAuthCredential as P, sendPasswordResetEmail as Q, sendSignInLinkToEmail as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, setPersistence as U, signInAnonymously as V, signInWithCredential as W, signInWithCustomToken as X, signInWithEmailAndPassword as Y, signInWithEmailLink as Z, signOut as _, indexedDBLocalPersistence as a, UserImpl as a$, updateCurrentUser as a0, updateEmail as a1, updatePassword as a2, updateProfile as a3, useDeviceLanguage as a4, validatePassword as a5, verifyBeforeUpdateEmail as a6, verifyPasswordResetCode as a7, STORAGE_AVAILABLE_KEY as a8, _isMobileBrowser as a9, signInWithIdp as aA, _fail as aB, debugAssert as aC, _assertInstanceOf as aD, _generateEventId as aE, FederatedAuthProvider as aF, _persistenceKeyName as aG, _performApiRequest as aH, _getCurrentUrl as aI, _gapiScriptUrl as aJ, _emulatorUrl as aK, _isChromeIOS as aL, _isFirefox as aM, _isIOSStandalone as aN, BaseOAuthProvider as aO, _setWindowLocation as aP, _isSafari as aQ, _isIOS as aR, MultiFactorAssertionImpl as aS, finalizeEnrollPhoneMfa as aT, finalizeSignInPhoneMfa as aU, _setExternalJSProvider as aV, _isAndroid as aW, _isIOS7Or8 as aX, AuthImpl as aY, FetchProvider as aZ, SAMLAuthCredential as a_, _isIE10 as aa, Delay as ab, MockReCaptcha as ac, _window as ad, _assert as ae, isV2 as af, _createError as ag, _recaptchaV2ScriptUrl as ah, _loadJS as ai, _generateCallbackName as aj, _castAuth as ak, _isHttpOrHttps as al, _isWorker as am, getRecaptchaParams as an, _assertLinkedStatus as ao, _serverAppCurrentUserOperationNotSupportedError as ap, _link as aq, _initializeRecaptchaConfig as ar, FAKE_TOKEN as as, startEnrollPhoneMfa as at, handleRecaptchaFlow as au, startSignInPhoneMfa as av, sendPhoneVerificationCode as aw, _getInstance as ax, _reauthenticate as ay, _signInWithCredential as az, AuthCredential as b, _getClientVersion as b0, connectAuthEmulator as c, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as d, EmailAuthProvider as e, GoogleAuthProvider as f, OAuthProvider as g, TotpSecret as h, initializeAuth as i, TwitterAuthProvider as j, applyActionCode as k, beforeAuthStateChanged as l, checkActionCode as m, confirmPasswordReset as n, createUserWithEmailAndPassword as o, debugErrorMap as p, deleteUser as q, registerAuth as r, fetchSignInMethodsForEmail as s, getAdditionalUserInfo as t, getIdToken as u, getIdTokenResult as v, getMultiFactorResolver as w, inMemoryPersistence as x, initializeRecaptchaConfig as y, isSignInWithEmailLink as z };
|
|
8422
|
-
//# sourceMappingURL=register-
|
|
8540
|
+
//# sourceMappingURL=register-B2Dp0WV3.js.map
|