Skip to content

Commit 959e062

Browse files
committed
Merge branch 'master' into fei-storage-compat
2 parents 85788f0 + a6d29aa commit 959e062

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_loader.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ describe('platform_browser/recaptcha/recaptcha_loader', () => {
6767
triggerNetworkTimeout = stubSingleTimeout(networkTimeoutId);
6868

6969
sinon.stub(jsHelpers, '_loadJS').callsFake(() => {
70-
return new Promise((resolve, reject) => {
70+
return (new Promise<void>((resolve, reject) => {
7171
jsLoader = { resolve, reject };
72-
});
72+
}) as unknown) as Promise<Event>;
7373
});
7474

7575
loader = new ReCaptchaLoaderImpl();

packages-exp/functions-compat/src/register.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ import {
2424
Component,
2525
ComponentType,
2626
InstanceFactory,
27-
ComponentContainer
27+
ComponentContainer,
28+
InstanceFactoryOptions
2829
} from '@firebase/component';
2930
import { Functions as FunctionsServiceExp } from '@firebase/functions-exp';
3031

32+
const DEFAULT_REGION = 'us-central1';
33+
3134
declare module '@firebase/component' {
3235
interface NameServiceMapping {
3336
'app-compat': FirebaseApp;
@@ -38,14 +41,14 @@ declare module '@firebase/component' {
3841

3942
const factory: InstanceFactory<'functions-compat'> = (
4043
container: ComponentContainer,
41-
regionOrCustomDomain?: string
44+
{ instanceIdentifier: regionOrCustomDomain }: InstanceFactoryOptions
4245
) => {
4346
// Dependencies
4447
const app = container.getProvider('app-compat').getImmediate();
4548
const functionsServiceExp = container
4649
.getProvider('functions-exp')
4750
.getImmediate({
48-
identifier: regionOrCustomDomain
51+
identifier: regionOrCustomDomain ?? DEFAULT_REGION
4952
});
5053

5154
return new FunctionsService(app, functionsServiceExp);

packages-exp/functions-exp/src/config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import {
2525
} from '@firebase/component';
2626
import { FUNCTIONS_TYPE } from './constants';
2727

28-
export const DEFAULT_REGION = 'us-central1';
29-
3028
export function registerFunctions(fetchImpl: typeof fetch): void {
3129
const factory: InstanceFactory<'functions'> = (
3230
container: ComponentContainer,

packages/auth/src/autheventmanager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fireauth.AuthEventManager.prototype.unsubscribe = function(handler) {
388388
fireauth.AuthEventManager.prototype.hasProcessedAuthEvent_ =
389389
function(authEvent) {
390390
// Prevent duplicate event tracker from growing too large.
391-
if (goog.now() - this.lastProcessedEventTime_ >=
391+
if (Date.now() - this.lastProcessedEventTime_ >=
392392
fireauth.AuthEventManager.EVENT_DUPLICATION_CACHE_DURATION) {
393393
this.processedEvents_ = {};
394394
this.lastProcessedEventTime_ = 0;
@@ -417,7 +417,7 @@ fireauth.AuthEventManager.prototype.saveProcessedAuthEvent_ =
417417
this.processedEvents_[
418418
/** @type {string} */ (authEvent.getUid())] = true;
419419
// Save last processing time.
420-
this.lastProcessedEventTime_ = goog.now();
420+
this.lastProcessedEventTime_ = Date.now();
421421
}
422422
};
423423

packages/auth/src/cacherequest.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ fireauth.CacheRequest = function() {
4242
/** @private {?goog.Promise} The cached returned promise result. */
4343
this.cachedResult_ = null;
4444
/** @private {number} The expiration timestamp of the cached result. */
45-
this.expirationTime_ = goog.now();
45+
this.expirationTime_ = Date.now();
4646
/** @private {number} The time to live from the caching point in time. */
4747
this.ttl_ = 0;
4848
/** @private {boolean} Whether to cache errors too. */
@@ -62,7 +62,7 @@ fireauth.CacheRequest.prototype.cache =
6262
this.func_ = func;
6363
this.self_ = self;
6464
this.arguments_ = args;
65-
this.expirationTime_ = goog.now();
65+
this.expirationTime_ = Date.now();
6666
this.ttl_ = ttl;
6767
this.cacheErrors_ = !!opt_cacheErrors;
6868

@@ -79,9 +79,9 @@ fireauth.CacheRequest.prototype.run = function() {
7979
throw new Error('No available configuration cached!');
8080
}
8181
// If the result is not cached or the cache result is outdated.
82-
if (!this.cachedResult_ || goog.now() >= this.expirationTime_) {
82+
if (!this.cachedResult_ || Date.now() >= this.expirationTime_) {
8383
// Set expiration of current request.
84-
this.expirationTime_ = goog.now() + this.ttl_;
84+
this.expirationTime_ = Date.now() + this.ttl_;
8585
// Get new result and cache it.
8686
this.cachedResult_ =
8787
this.func_.apply(this.self_, this.arguments_).then(function(result) {
@@ -93,7 +93,7 @@ fireauth.CacheRequest.prototype.run = function() {
9393
if (!self.cacheErrors_) {
9494
// Do not cache errors if errors are not to be cached.
9595
// This will bust the cached result. Otherwise the error is cached.
96-
self.expirationTime_ = goog.now();
96+
self.expirationTime_ = Date.now();
9797
}
9898
// Throw the returned error.
9999
throw error;
@@ -108,5 +108,5 @@ fireauth.CacheRequest.prototype.run = function() {
108108
fireauth.CacheRequest.prototype.purge = function() {
109109
// Purge the cached results.
110110
this.cachedResult_ = null;
111-
this.expirationTime_ = goog.now();
111+
this.expirationTime_ = Date.now();
112112
};

packages/auth/src/rpchandler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ fireauth.RpcHandler.prototype.requestAuthEndpoint_ = function(
905905
uri.setParameterValue('key', this.getApiKey());
906906
// Check whether to append cachebuster to request.
907907
if (opt_cachebuster) {
908-
uri.setParameterValue('cb', goog.now().toString());
908+
uri.setParameterValue('cb', Date.now().toString());
909909
}
910910
// Firebase allows GET endpoints.
911911
var isGet = httpMethod == fireauth.RpcHandler.HttpMethod.GET;

packages/auth/test/proactiverefresh_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ function setUp() {
7171
// Operation to practively refresh.
7272
operation = goog.testing.recordFunction(function() {
7373
// Record last run time.
74-
lastTimestamp = goog.now();
74+
lastTimestamp = Date.now();
7575
if (!forceRetryError) {
7676
// Do not force error retry. Resolve successfully.
7777
return goog.Promise.resolve();
@@ -84,7 +84,7 @@ function setUp() {
8484
// Operation which throws an unrecoverable error.
8585
unrecoverableOperation = goog.testing.recordFunction(function() {
8686
// Record last run time.
87-
lastTimestamp = goog.now();
87+
lastTimestamp = Date.now();
8888
// Throw unrecoverable error.
8989
return goog.Promise.reject(
9090
new fireauth.AuthError(fireauth.authenum.Error.INTERNAL_ERROR));

0 commit comments

Comments
 (0)