@firebase/auth 1.13.9 → 1.13.10-20261110194028

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.
Files changed (70) hide show
  1. package/dist/auth-public.d.ts +1 -0
  2. package/dist/auth.d.ts +1 -0
  3. package/dist/browser-cjs/{index-DTUcAMkM.js → index-CWK8eckO.js} +180 -62
  4. package/dist/browser-cjs/index-CWK8eckO.js.map +1 -0
  5. package/dist/browser-cjs/index.js +1 -1
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/core/persistence/index.d.ts +1 -0
  8. package/dist/browser-cjs/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  9. package/dist/cordova/auth-cordova-public.d.ts +1 -0
  10. package/dist/cordova/auth-cordova.d.ts +1 -0
  11. package/dist/cordova/index.js +2 -2
  12. package/dist/cordova/internal.js +2 -2
  13. package/dist/cordova/{popup_redirect-xyFFcAgj.js → popup_redirect-_-tO-o8H.js} +180 -62
  14. package/dist/cordova/popup_redirect-_-tO-o8H.js.map +1 -0
  15. package/dist/cordova/src/core/persistence/index.d.ts +1 -0
  16. package/dist/cordova/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  17. package/dist/esm/{index-Bz2J43nW.js → index-CGm68jO1.js} +180 -62
  18. package/dist/esm/index-CGm68jO1.js.map +1 -0
  19. package/dist/esm/index.js +1 -1
  20. package/dist/esm/internal.js +2 -2
  21. package/dist/esm/src/core/persistence/index.d.ts +1 -0
  22. package/dist/esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  23. package/dist/index.webworker.js +179 -61
  24. package/dist/index.webworker.js.map +1 -1
  25. package/dist/node/index.js +1 -1
  26. package/dist/node/internal.js +1 -1
  27. package/dist/node/internal.js.map +1 -1
  28. package/dist/node/src/core/persistence/index.d.ts +1 -0
  29. package/dist/node/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  30. package/dist/node/{totp-CMTC0AYP.js → totp-CMj0kbMN.js} +49 -30
  31. package/dist/node/totp-CMj0kbMN.js.map +1 -0
  32. package/dist/node-esm/index.js +1 -1
  33. package/dist/node-esm/internal.js +2 -2
  34. package/dist/node-esm/internal.js.map +1 -1
  35. package/dist/node-esm/src/core/persistence/index.d.ts +1 -0
  36. package/dist/node-esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  37. package/dist/node-esm/{totp-pe8Y0u5S.js → totp-C1gXPzeQ.js} +49 -30
  38. package/dist/node-esm/totp-C1gXPzeQ.js.map +1 -0
  39. package/dist/rn/{index-DzY9h3Kn.js → index-CkEQlRgG.js} +49 -30
  40. package/dist/rn/index-CkEQlRgG.js.map +1 -0
  41. package/dist/rn/index.js +1 -1
  42. package/dist/rn/internal.js +132 -33
  43. package/dist/rn/internal.js.map +1 -1
  44. package/dist/rn/src/core/persistence/index.d.ts +1 -0
  45. package/dist/rn/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  46. package/dist/src/core/persistence/index.d.ts +1 -0
  47. package/dist/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  48. package/dist/web-extension-cjs/index.js +1 -1
  49. package/dist/web-extension-cjs/internal.js +1 -1
  50. package/dist/web-extension-cjs/{register-CTiLN4Sf.js → register-DDH4JTxZ.js} +180 -62
  51. package/dist/web-extension-cjs/register-DDH4JTxZ.js.map +1 -0
  52. package/dist/web-extension-cjs/src/core/persistence/index.d.ts +1 -0
  53. package/dist/web-extension-cjs/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  54. package/dist/web-extension-esm/auth-web-extension-public.d.ts +1 -0
  55. package/dist/web-extension-esm/auth-web-extension.d.ts +1 -0
  56. package/dist/web-extension-esm/index.js +2 -2
  57. package/dist/web-extension-esm/internal.js +2 -2
  58. package/dist/web-extension-esm/{register-DBjcU-NC.js → register-BjPfSC3G.js} +180 -62
  59. package/dist/web-extension-esm/register-BjPfSC3G.js.map +1 -0
  60. package/dist/web-extension-esm/src/core/persistence/index.d.ts +1 -0
  61. package/dist/web-extension-esm/src/platform_browser/persistence/indexed_db.d.ts +18 -4
  62. package/package.json +1 -1
  63. package/dist/browser-cjs/index-DTUcAMkM.js.map +0 -1
  64. package/dist/cordova/popup_redirect-xyFFcAgj.js.map +0 -1
  65. package/dist/esm/index-Bz2J43nW.js.map +0 -1
  66. package/dist/node/totp-CMTC0AYP.js.map +0 -1
  67. package/dist/node-esm/totp-pe8Y0u5S.js.map +0 -1
  68. package/dist/rn/index-DzY9h3Kn.js.map +0 -1
  69. package/dist/web-extension-cjs/register-CTiLN4Sf.js.map +0 -1
  70. 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.
@@ -2143,31 +2143,25 @@ class PersistenceUserManager {
2143
2143
  if (!persistenceHierarchy.length) {
2144
2144
  return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);
2145
2145
  }
2146
- // Eliminate any persistences that are not available
2147
- const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {
2146
+ const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);
2147
+ // Search for an existing user across all persistences before running `_isAvailable()`.
2148
+ // `_get` only opens a `readonly` transaction in IndexedDB, whereas `_isAvailable()` opens
2149
+ // a `readwrite` transaction; if another tab is suspended holding a `readonly` transaction
2150
+ // (#10540), queuing a `readwrite` transaction first blocks subsequent `readonly` transactions
2151
+ // in the browser's IndexedDB lock manager.
2152
+ let foundUser = null;
2153
+ let foundPersistence = null;
2154
+ const unreadablePersistences = new Set();
2155
+ for (const persistence of persistenceHierarchy) {
2156
+ let blob = null;
2148
2157
  try {
2149
- if (await persistence._isAvailable()) {
2150
- return persistence;
2151
- }
2158
+ blob = await persistence._get(key);
2152
2159
  }
2153
2160
  catch {
2154
- return undefined;
2161
+ unreadablePersistences.add(persistence);
2162
+ continue;
2155
2163
  }
2156
- return undefined;
2157
- }))).filter(persistence => persistence);
2158
- // Fall back to the first persistence listed, or in memory if none available
2159
- let selectedPersistence = availablePersistences[0] ||
2160
- _getInstance(inMemoryPersistence);
2161
- const key = _persistenceKeyName(userKey, auth.config.apiKey, auth.name);
2162
- // Pull out the existing user, setting the chosen persistence to that
2163
- // persistence if the user exists.
2164
- let userToMigrate = null;
2165
- // Note, here we check for a user in _all_ persistences, not just the
2166
- // ones deemed available. If we can migrate a user out of a broken
2167
- // persistence, we will (but only if that persistence supports migration).
2168
- for (const persistence of persistenceHierarchy) {
2169
2164
  try {
2170
- const blob = await persistence._get(key);
2171
2165
  if (blob) {
2172
2166
  let user;
2173
2167
  if (typeof blob === 'string') {
@@ -2182,15 +2176,38 @@ class PersistenceUserManager {
2182
2176
  else {
2183
2177
  user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
2184
2178
  }
2185
- if (persistence !== selectedPersistence) {
2186
- userToMigrate = user;
2187
- }
2188
- selectedPersistence = persistence;
2179
+ foundUser = user;
2180
+ foundPersistence = persistence;
2189
2181
  break;
2190
2182
  }
2191
2183
  }
2192
2184
  catch { }
2193
2185
  }
2186
+ // Eliminate any persistences that are not available
2187
+ const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {
2188
+ try {
2189
+ if (await persistence._isAvailable()) {
2190
+ return persistence;
2191
+ }
2192
+ if (persistence._lastProbeTimedOut) {
2193
+ unreadablePersistences.add(persistence);
2194
+ }
2195
+ }
2196
+ catch {
2197
+ return undefined;
2198
+ }
2199
+ return undefined;
2200
+ }))).filter(persistence => persistence);
2201
+ // Fall back to the first persistence listed, or in memory if none available
2202
+ let selectedPersistence = availablePersistences[0] ||
2203
+ _getInstance(inMemoryPersistence);
2204
+ let userToMigrate = null;
2205
+ if (foundPersistence && foundUser) {
2206
+ if (foundPersistence !== selectedPersistence) {
2207
+ userToMigrate = foundUser;
2208
+ }
2209
+ selectedPersistence = foundPersistence;
2210
+ }
2194
2211
  // If we find the user in a persistence that does support migration, use
2195
2212
  // that migration path (of only persistences that support migration)
2196
2213
  const migrationHierarchy = availablePersistences.filter(p => p._shouldAllowMigration);
@@ -2205,10 +2222,13 @@ class PersistenceUserManager {
2205
2222
  // we'll just let it bubble to surface the error.
2206
2223
  await selectedPersistence._set(key, userToMigrate.toJSON());
2207
2224
  }
2208
- // Attempt to clear the key in other persistences but ignore errors. This helps prevent issues
2209
- // such as users getting stuck with a previous account after signing out and refreshing the tab.
2225
+ // Attempt to clear the key in other persistences (except those whose _get threw or whose
2226
+ // _isAvailable() probe timed out, so we never delete from a store we couldn't read or that
2227
+ // is blocked by another tab) and ignore errors. This helps prevent issues such as users
2228
+ // getting stuck with a previous account after signing out and refreshing the tab.
2210
2229
  await Promise.all(persistenceHierarchy.map(async (persistence) => {
2211
- if (persistence !== selectedPersistence) {
2230
+ if (persistence !== selectedPersistence &&
2231
+ !unreadablePersistences.has(persistence)) {
2212
2232
  try {
2213
2233
  await persistence._remove(key);
2214
2234
  }
@@ -2730,7 +2750,6 @@ class AuthImpl {
2730
2750
  }
2731
2751
  catch (e) {
2732
2752
  _logWarn(`Failed to initialize current user: ${e}`);
2733
- await this.directlySetCurrentUser(null).catch(() => { });
2734
2753
  }
2735
2754
  this.lastNotifiedUid = this.currentUser?.uid || null;
2736
2755
  if (this._deleted) {
@@ -8218,6 +8237,23 @@ const DB_NAME = 'firebaseLocalStorageDb';
8218
8237
  const DB_VERSION = 1;
8219
8238
  const DB_OBJECTSTORE_NAME = 'firebaseLocalStorage';
8220
8239
  const DB_DATA_KEYPATH = 'fbase_key';
8240
+ const _POLLING_INTERVAL_MS = 800;
8241
+ const _TRANSACTION_RETRY_COUNT = 3;
8242
+ /**
8243
+ * Short timeout scoped to the `readwrite` availability probe in `_isAvailable()`.
8244
+ * Matches `_POLLING_INTERVAL_MS` so that if a background tab is suspended while
8245
+ * holding a `readonly` poll transaction that blocks `readwrite` transactions
8246
+ * (#10540), the startup probe fails fast and aborts its queued transaction in
8247
+ * under a second without blocking fallback or user loading.
8248
+ */
8249
+ const _DB_PROBE_TIMEOUT_MS = 800;
8250
+ /**
8251
+ * Timeout for opening the database and regular IndexedDB read/write requests.
8252
+ * Kept at multiple seconds to accommodate cold `indexedDB.open()` or slow disk
8253
+ * I/O on low-end devices without premature timeouts.
8254
+ */
8255
+ const _DB_TIMEOUT_MS = 2500;
8256
+ const DB_TIMEOUT_ERROR = 'DB_TIMEOUT';
8221
8257
  /**
8222
8258
  * Promise wrapper for IDBRequest
8223
8259
  *
@@ -8228,13 +8264,32 @@ class DBPromise {
8228
8264
  constructor(request) {
8229
8265
  this.request = request;
8230
8266
  }
8231
- toPromise() {
8267
+ toPromise(timeoutMs = _DB_TIMEOUT_MS) {
8232
8268
  return new Promise((resolve, reject) => {
8269
+ let settled = false;
8270
+ const timer = setTimeout(() => {
8271
+ if (!settled) {
8272
+ settled = true;
8273
+ try {
8274
+ this.request.transaction?.abort();
8275
+ }
8276
+ catch { }
8277
+ reject(new Error(DB_TIMEOUT_ERROR));
8278
+ }
8279
+ }, timeoutMs);
8233
8280
  this.request.addEventListener('success', () => {
8234
- resolve(this.request.result);
8281
+ if (!settled) {
8282
+ settled = true;
8283
+ clearTimeout(timer);
8284
+ resolve(this.request.result);
8285
+ }
8235
8286
  });
8236
8287
  this.request.addEventListener('error', () => {
8237
- reject(this.request.error);
8288
+ if (!settled) {
8289
+ settled = true;
8290
+ clearTimeout(timer);
8291
+ reject(this.request.error);
8292
+ }
8238
8293
  });
8239
8294
  });
8240
8295
  }
@@ -8251,8 +8306,19 @@ function _deleteDatabase() {
8251
8306
  function _openDatabase() {
8252
8307
  const request = indexedDB.open(DB_NAME, DB_VERSION);
8253
8308
  return new Promise((resolve, reject) => {
8309
+ let settled = false;
8310
+ const timer = setTimeout(() => {
8311
+ if (!settled) {
8312
+ settled = true;
8313
+ reject(new Error(DB_TIMEOUT_ERROR));
8314
+ }
8315
+ }, _DB_TIMEOUT_MS);
8254
8316
  request.addEventListener('error', () => {
8255
- reject(request.error);
8317
+ if (!settled) {
8318
+ settled = true;
8319
+ clearTimeout(timer);
8320
+ reject(request.error);
8321
+ }
8256
8322
  });
8257
8323
  request.addEventListener('upgradeneeded', () => {
8258
8324
  const db = request.result;
@@ -8260,11 +8326,20 @@ function _openDatabase() {
8260
8326
  db.createObjectStore(DB_OBJECTSTORE_NAME, { keyPath: DB_DATA_KEYPATH });
8261
8327
  }
8262
8328
  catch (e) {
8263
- reject(e);
8329
+ if (!settled) {
8330
+ settled = true;
8331
+ clearTimeout(timer);
8332
+ reject(e);
8333
+ }
8264
8334
  }
8265
8335
  });
8266
8336
  request.addEventListener('success', async () => {
8267
8337
  const db = request.result;
8338
+ if (settled) {
8339
+ db.close();
8340
+ return;
8341
+ }
8342
+ clearTimeout(timer);
8268
8343
  // Strange bug that occurs in Firefox when multiple tabs are opened at the
8269
8344
  // same time. The only way to recover seems to be deleting the database
8270
8345
  // and re-initializing it.
@@ -8272,33 +8347,45 @@ function _openDatabase() {
8272
8347
  if (!db.objectStoreNames.contains(DB_OBJECTSTORE_NAME)) {
8273
8348
  // Need to close the database or else you get a `blocked` event
8274
8349
  db.close();
8275
- await _deleteDatabase();
8276
- resolve(await _openDatabase());
8350
+ try {
8351
+ // Note: if `deleteDatabase` is `blocked` by another tab's open connection and
8352
+ // times out (`DB_TIMEOUT_ERROR`), `request.transaction` is null so the browser
8353
+ // keeps the delete request queued until all blocking connections close.
8354
+ await _deleteDatabase();
8355
+ const reopenedDb = await _openDatabase();
8356
+ settled = true;
8357
+ resolve(reopenedDb);
8358
+ }
8359
+ catch (e) {
8360
+ if (!settled) {
8361
+ settled = true;
8362
+ reject(e);
8363
+ }
8364
+ }
8277
8365
  }
8278
8366
  else {
8367
+ settled = true;
8279
8368
  resolve(db);
8280
8369
  }
8281
8370
  });
8282
8371
  });
8283
8372
  }
8284
- async function _putObject(db, key, value) {
8373
+ async function _putObject(db, key, value, timeoutMs = _DB_TIMEOUT_MS) {
8285
8374
  const request = getObjectStore(db, true).put({
8286
8375
  [DB_DATA_KEYPATH]: key,
8287
8376
  value
8288
8377
  });
8289
- return new DBPromise(request).toPromise();
8378
+ return new DBPromise(request).toPromise(timeoutMs);
8290
8379
  }
8291
8380
  async function getObject(db, key) {
8292
8381
  const request = getObjectStore(db, false).get(key);
8293
8382
  const data = await new DBPromise(request).toPromise();
8294
8383
  return data === undefined ? null : data.value;
8295
8384
  }
8296
- function _deleteObject(db, key) {
8385
+ function _deleteObject(db, key, timeoutMs = _DB_TIMEOUT_MS) {
8297
8386
  const request = getObjectStore(db, true).delete(key);
8298
- return new DBPromise(request).toPromise();
8387
+ return new DBPromise(request).toPromise(timeoutMs);
8299
8388
  }
8300
- const _POLLING_INTERVAL_MS = 800;
8301
- const _TRANSACTION_RETRY_COUNT = 3;
8302
8389
  class IndexedDBLocalPersistence {
8303
8390
  registerLifecycleListeners() {
8304
8391
  if (typeof window !== 'undefined' &&
@@ -8325,6 +8412,7 @@ class IndexedDBLocalPersistence {
8325
8412
  this.pollTimer = null;
8326
8413
  this.isClosing = false;
8327
8414
  this.pendingWrites = 0;
8415
+ this._lastProbeTimedOut = false;
8328
8416
  this.receiver = null;
8329
8417
  this.sender = null;
8330
8418
  this.serviceWorkerReceiverAvailable = false;
@@ -8353,32 +8441,46 @@ class IndexedDBLocalPersistence {
8353
8441
  if (this.dbPromise) {
8354
8442
  return this.dbPromise;
8355
8443
  }
8356
- this.dbPromise = _openDatabase();
8357
- this.dbPromise.catch(() => {
8358
- this.dbPromise = null;
8444
+ const dbPromise = _openDatabase();
8445
+ this.dbPromise = dbPromise;
8446
+ dbPromise.catch(() => {
8447
+ if (this.dbPromise === dbPromise) {
8448
+ this.dbPromise = null;
8449
+ }
8359
8450
  });
8360
- return this.dbPromise;
8451
+ return dbPromise;
8361
8452
  }
8362
8453
  async _withRetries(op) {
8363
8454
  let numAttempts = 0;
8364
8455
  while (true) {
8456
+ let db;
8457
+ let dbPromiseBeforeOp = null;
8365
8458
  try {
8366
- const db = await this._openDb();
8459
+ const openPromise = this._openDb();
8460
+ dbPromiseBeforeOp = this.dbPromise;
8461
+ db = await openPromise;
8367
8462
  return await op(db);
8368
8463
  }
8369
8464
  catch (e) {
8370
- if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
8371
- throw e;
8465
+ if (db) {
8466
+ db.close();
8467
+ if (dbPromiseBeforeOp && this.dbPromise === dbPromiseBeforeOp) {
8468
+ this.dbPromise = null;
8469
+ }
8372
8470
  }
8373
- if (this.dbPromise) {
8374
- const dbPromise = this.dbPromise;
8471
+ else if (this.dbPromise && this.dbPromise === dbPromiseBeforeOp) {
8472
+ const currentDbPromise = this.dbPromise;
8375
8473
  this.dbPromise = null;
8376
8474
  try {
8377
- const db = await dbPromise;
8378
- db.close();
8475
+ const openedDb = await currentDbPromise;
8476
+ openedDb.close();
8379
8477
  }
8380
8478
  catch { }
8381
8479
  }
8480
+ const isTimeout = e instanceof Error && e.message === DB_TIMEOUT_ERROR;
8481
+ if (isTimeout || numAttempts++ > _TRANSACTION_RETRY_COUNT) {
8482
+ throw e;
8483
+ }
8382
8484
  // TODO: consider adding exponential backoff
8383
8485
  }
8384
8486
  }
@@ -8458,17 +8560,21 @@ class IndexedDBLocalPersistence {
8458
8560
  }
8459
8561
  }
8460
8562
  async _isAvailable() {
8563
+ this._lastProbeTimedOut = false;
8461
8564
  try {
8462
8565
  if (!indexedDB) {
8463
8566
  return false;
8464
8567
  }
8465
8568
  await this._withRetries(async (db) => {
8466
- await _putObject(db, STORAGE_AVAILABLE_KEY, '1');
8467
- await _deleteObject(db, STORAGE_AVAILABLE_KEY);
8569
+ await _putObject(db, STORAGE_AVAILABLE_KEY, '1', _DB_PROBE_TIMEOUT_MS);
8570
+ await _deleteObject(db, STORAGE_AVAILABLE_KEY, _DB_PROBE_TIMEOUT_MS);
8468
8571
  });
8469
8572
  return true;
8470
8573
  }
8471
- catch { }
8574
+ catch (e) {
8575
+ this._lastProbeTimedOut =
8576
+ e instanceof Error && e.message === DB_TIMEOUT_ERROR;
8577
+ }
8472
8578
  return false;
8473
8579
  }
8474
8580
  async _withPendingWrite(write) {
@@ -8488,9 +8594,19 @@ class IndexedDBLocalPersistence {
8488
8594
  });
8489
8595
  }
8490
8596
  async _get(key) {
8491
- const obj = (await this._withRetries((db) => getObject(db, key)));
8492
- this.localCache[key] = obj;
8493
- return obj;
8597
+ try {
8598
+ const obj = (await this._withRetries((db) => getObject(db, key)));
8599
+ this.localCache[key] = obj;
8600
+ return obj;
8601
+ }
8602
+ catch (e) {
8603
+ if (e instanceof Error &&
8604
+ e.message === DB_TIMEOUT_ERROR &&
8605
+ this.localCache[key] != null) {
8606
+ return this.localCache[key];
8607
+ }
8608
+ throw e;
8609
+ }
8494
8610
  }
8495
8611
  async _remove(key) {
8496
8612
  return this._withPendingWrite(async () => {
@@ -8572,8 +8688,10 @@ class IndexedDBLocalPersistence {
8572
8688
  }
8573
8689
  if (!this.listeners[key]) {
8574
8690
  this.listeners[key] = new Set();
8575
- // Populate the cache to avoid spuriously triggering on first poll.
8576
- void this._get(key).catch(() => { }); // This can happen in the background async and we can return immediately.
8691
+ if (!(key in this.localCache)) {
8692
+ // Populate the cache to avoid spuriously triggering on first poll.
8693
+ void this._get(key).catch(() => { }); // This can happen in the background async and we can return immediately.
8694
+ }
8577
8695
  }
8578
8696
  this.listeners[key].add(listener);
8579
8697
  }
@@ -11078,7 +11196,7 @@ function _isEmptyString(input) {
11078
11196
  }
11079
11197
 
11080
11198
  var name = "@firebase/auth";
11081
- var version = "1.13.9";
11199
+ var version = "1.13.10-20261110194028";
11082
11200
 
11083
11201
  /**
11084
11202
  * @license
@@ -11331,4 +11449,4 @@ _setExternalJSProvider({
11331
11449
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
11332
11450
 
11333
11451
  export { onIdTokenChanged as $, ActionCodeOperation as A, fetchSignInMethodsForEmail as B, getAdditionalUserInfo as C, getAuth as D, EmailAuthCredential as E, FacebookAuthProvider as F, GithubAuthProvider as G, getIdToken as H, getIdTokenResult as I, getMultiFactorResolver as J, getRedirectResult as K, inMemoryPersistence as L, indexedDBLocalPersistence as M, initializeAuth as N, OAuthCredential as O, PhoneAuthCredential as P, initializeRecaptchaConfig as Q, RecaptchaVerifier as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, isSignInWithEmailLink as U, linkWithCredential as V, linkWithPhoneNumber as W, linkWithPopup as X, linkWithRedirect as Y, multiFactor as Z, onAuthStateChanged as _, ActionCodeURL as a, parseActionCodeURL as a0, prodErrorMap as a1, reauthenticateWithCredential as a2, reauthenticateWithPhoneNumber as a3, reauthenticateWithPopup as a4, reauthenticateWithRedirect as a5, reload as a6, revokeAccessToken as a7, sendEmailVerification as a8, sendPasswordResetEmail as a9, _getRedirectUrl as aA, _isIOS7Or8 as aB, _createError as aC, _getProjectConfig as aD, AuthEventManager as aE, _getInstance as aF, _persistenceKeyName as aG, _getRedirectResult as aH, _overrideRedirectResult as aI, _clearRedirectOutcomes as aJ, _castAuth as aK, AuthImpl as aL, AuthPopup as aM, FetchProvider as aN, SAMLAuthCredential as aO, UserImpl as aP, _generateEventId as aQ, _getClientVersion as aR, sendSignInLinkToEmail as aa, setPersistence as ab, signInAnonymously as ac, signInWithCredential as ad, signInWithCustomToken as ae, signInWithEmailAndPassword as af, signInWithEmailLink as ag, signInWithPhoneNumber as ah, signInWithPopup as ai, signInWithRedirect as aj, signOut as ak, unlink as al, updateCurrentUser as am, updateEmail as an, updatePassword as ao, updatePhoneNumber as ap, updateProfile as aq, useDeviceLanguage as ar, validatePassword as as, verifyBeforeUpdateEmail as at, verifyPasswordResetCode as au, _assert as av, debugAssert as aw, _isIOS as ax, _isAndroid as ay, _fail as az, AuthCredential as b, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as c, EmailAuthProvider as d, FactorId as e, GoogleAuthProvider as f, OAuthProvider as g, OperationType as h, PhoneAuthProvider as i, PhoneMultiFactorGenerator as j, ProviderId as k, SignInMethod as l, TotpSecret as m, TwitterAuthProvider as n, applyActionCode as o, beforeAuthStateChanged as p, browserCookiePersistence as q, browserLocalPersistence as r, browserPopupRedirectResolver as s, browserSessionPersistence as t, checkActionCode as u, confirmPasswordReset as v, connectAuthEmulator as w, createUserWithEmailAndPassword as x, debugErrorMap as y, deleteUser as z };
11334
- //# sourceMappingURL=index-Bz2J43nW.js.map
11452
+ //# sourceMappingURL=index-CGm68jO1.js.map