Skip to content

Commit 7ac1e98

Browse files
committed
Cleans up some comments in the Auth open sourced code.
1 parent bb69096 commit 7ac1e98

38 files changed

+190
-191
lines changed

packages/auth/src/actioncodesettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fireauth.ActionCodeSettings.prototype.initialize_ = function(settingsObj) {
7272
var amv = androidSettings[
7373
fireauth.ActionCodeSettings.AndroidRawField.MINIMUM_VERSION];
7474
if (typeof apn === 'string' && apn.length) {
75-
this.apn_ = /** @type {string}*/ (apn);
75+
this.apn_ = /** @type {string} */ (apn);
7676
if (typeof installApp !== 'undefined' &&
7777
typeof installApp !== 'boolean') {
7878
throw new fireauth.AuthError(
@@ -97,7 +97,7 @@ fireauth.ActionCodeSettings.prototype.initialize_ = function(settingsObj) {
9797
' property must be a non empty string when specified.');
9898
} else if (typeof installApp !== 'undefined' ||
9999
typeof amv !== 'undefined') {
100-
// If installApp or amv specified with no valid apn, fail quickly.
100+
// If installApp or amv specified with no valid APN, fail quickly.
101101
throw new fireauth.AuthError(
102102
fireauth.authenum.Error.MISSING_ANDROID_PACKAGE_NAME);
103103
}

packages/auth/src/additionaluserinfo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fireauth.AdditionalUserInfo.fromPlainObject = function(resp) {
5858
fireauth.GithubAdditionalUserInfo;
5959
factory[fireauth.idp.ProviderId.TWITTER] =
6060
fireauth.TwitterAdditionalUserInfo;
61-
// Provider id and uid are required.
61+
// Provider ID and UID are required.
6262
var providerId =
6363
resp &&
6464
resp[fireauth.AdditionalUserInfo.VerifyAssertionField.PROVIDER_ID];
@@ -174,7 +174,7 @@ fireauth.FacebookAdditionalUserInfo = function(info) {
174174
fireauth.FacebookAdditionalUserInfo.base(this, 'constructor', info);
175175
// This should not happen as this object is initialized via fromPlainObject.
176176
if (this['providerId'] != fireauth.idp.ProviderId.FACEBOOK) {
177-
throw new Error('Invalid provider id!');
177+
throw new Error('Invalid provider ID!');
178178
}
179179
};
180180
goog.inherits(
@@ -193,7 +193,7 @@ fireauth.GithubAdditionalUserInfo = function(info) {
193193
fireauth.GithubAdditionalUserInfo.base(this, 'constructor', info);
194194
// This should not happen as this object is initialized via fromPlainObject.
195195
if (this['providerId'] != fireauth.idp.ProviderId.GITHUB) {
196-
throw new Error('Invalid provider id!');
196+
throw new Error('Invalid provider ID!');
197197
}
198198
// GitHub username.
199199
fireauth.object.setReadonlyProperty(
@@ -217,7 +217,7 @@ fireauth.GoogleAdditionalUserInfo = function(info) {
217217
fireauth.GoogleAdditionalUserInfo.base(this, 'constructor', info);
218218
// This should not happen as this object is initialized via fromPlainObject.
219219
if (this['providerId'] != fireauth.idp.ProviderId.GOOGLE) {
220-
throw new Error('Invalid provider id!');
220+
throw new Error('Invalid provider ID!');
221221
}
222222
};
223223
goog.inherits(
@@ -236,7 +236,7 @@ fireauth.TwitterAdditionalUserInfo = function(info) {
236236
fireauth.TwitterAdditionalUserInfo.base(this, 'constructor', info);
237237
// This should not happen as this object is initialized via fromPlainObject.
238238
if (this['providerId'] != fireauth.idp.ProviderId.TWITTER) {
239-
throw new Error('Invalid provider id!');
239+
throw new Error('Invalid provider ID!');
240240
}
241241
// Twitter user name.
242242
fireauth.object.setReadonlyProperty(

packages/auth/src/auth.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ goog.require('goog.object');
5151

5252

5353
/**
54-
* Creates the Firebase Auth corresponding for the app provided.
54+
* Creates the Firebase Auth corresponding for the App provided.
5555
*
5656
* @param {!firebase.app.App} app The corresponding Firebase App.
5757
* @constructor
@@ -62,10 +62,10 @@ goog.require('goog.object');
6262
fireauth.Auth = function(app) {
6363
/** @private {boolean} Whether this instance is deleted. */
6464
this.deleted_ = false;
65-
/** Auth's corresponding app. */
65+
/** Auth's corresponding App. */
6666
fireauth.object.setReadonlyProperty(this, 'app', app);
67-
// Initialize rpc handler.
68-
// Api key is required for web client rpc calls.
67+
// Initialize RPC handler.
68+
// API key is required for web client RPC calls.
6969
if (this.app_().options && this.app_().options['apiKey']) {
7070
var clientFullVersion = firebase.SDK_VERSION ?
7171
fireauth.util.getClientVersion(
@@ -159,7 +159,7 @@ fireauth.Auth = function(app) {
159159
this.INTERNAL['delete'] = goog.bind(this.delete, this);
160160
this.INTERNAL['logFramework'] = goog.bind(this.logFramework, this);
161161
/**
162-
* @private {number} The number of Firebase services subscribed to auth
162+
* @private {number} The number of Firebase services subscribed to Auth
163163
* changes.
164164
*/
165165
this.firebaseServices_ = 0;
@@ -206,7 +206,7 @@ goog.inherits(fireauth.Auth.FrameworkChangeEvent, goog.events.Event);
206206

207207
/**
208208
* Changes the Auth state persistence to the specified one.
209-
* @param {!fireauth.authStorage.Persistence} persistence The auth state
209+
* @param {!fireauth.authStorage.Persistence} persistence The Auth state
210210
* persistence mechanism.
211211
* @return {!goog.Promise<void>}
212212
*/
@@ -349,7 +349,7 @@ fireauth.Auth.prototype.notifyLanguageCodeListeners_ = function() {
349349
*/
350350
fireauth.Auth.prototype.toJSON = function() {
351351
// Return the plain object representation in case JSON.stringify is called on
352-
// an auth instance.
352+
// an Auth instance.
353353
return {
354354
'apiKey': this.app_().options['apiKey'],
355355
'authDomain': this.app_().options['authDomain'],
@@ -365,8 +365,8 @@ fireauth.Auth.prototype.toJSON = function() {
365365
* @private
366366
*/
367367
fireauth.Auth.prototype.getAuthEventManager_ = function() {
368-
// Either return cached auth event manager promise provider if available or a
369-
// promise that rejects with missing auth domain error.
368+
// Either return cached Auth event manager promise provider if available or a
369+
// promise that rejects with missing Auth domain error.
370370
return this.eventManagerProviderPromise_ ||
371371
goog.Promise.reject(
372372
new fireauth.AuthError(fireauth.authenum.Error.MISSING_AUTH_DOMAIN));
@@ -378,13 +378,13 @@ fireauth.Auth.prototype.getAuthEventManager_ = function() {
378378
* @private
379379
*/
380380
fireauth.Auth.prototype.initAuthEventManager_ = function() {
381-
// Initialize auth event manager on initState.
381+
// Initialize Auth event manager on initState.
382382
var self = this;
383383
var authDomain = this.app_().options['authDomain'];
384384
var apiKey = this.app_().options['apiKey'];
385385
// Make sure environment also supports popup and redirect.
386386
if (authDomain && fireauth.util.isPopupRedirectSupported()) {
387-
// auth domain is required for auth event manager to resolve.
387+
// Auth domain is required for Auth event manager to resolve.
388388
// Auth state has to be loaded first. One reason is to process link events.
389389
this.eventManagerProviderPromise_ = this.authStateLoaded_.then(function() {
390390
if (self.deleted_) {
@@ -427,7 +427,7 @@ fireauth.Auth.prototype.initAuthEventManager_ = function() {
427427

428428
/**
429429
* @param {!fireauth.AuthEvent.Type} mode The Auth type mode.
430-
* @param {?string=} opt_eventId The event id.
430+
* @param {?string=} opt_eventId The event ID.
431431
* @return {boolean} Whether the auth event handler can handler the provided
432432
* event.
433433
* @override
@@ -442,7 +442,7 @@ fireauth.Auth.prototype.canHandleAuthEvent = function(mode, opt_eventId) {
442442
case fireauth.AuthEvent.Type.SIGN_IN_VIA_REDIRECT:
443443
return true;
444444
case fireauth.AuthEvent.Type. SIGN_IN_VIA_POPUP:
445-
// Pending sign in with popup event must match the stored popup event id.
445+
// Pending sign in with popup event must match the stored popup event ID.
446446
return this.popupEventId_ == opt_eventId &&
447447
!!this.pendingPopupResolvePromise_;
448448
default:
@@ -454,16 +454,16 @@ fireauth.Auth.prototype.canHandleAuthEvent = function(mode, opt_eventId) {
454454
/**
455455
* Completes the pending popup operation. If error is not null, rejects with the
456456
* error. Otherwise, it resolves with the popup redirect result.
457-
* @param {!fireauth.AuthEvent.Type} mode The auth type mode.
457+
* @param {!fireauth.AuthEvent.Type} mode The Auth type mode.
458458
* @param {?fireauth.AuthEventManager.Result} popupRedirectResult The result
459459
* to resolve with when no error supplied.
460460
* @param {?fireauth.AuthError} error When supplied, the promise will reject.
461-
* @param {?string=} opt_eventId The event id.
461+
* @param {?string=} opt_eventId The event ID.
462462
* @override
463463
*/
464464
fireauth.Auth.prototype.resolvePendingPopupEvent =
465465
function(mode, popupRedirectResult, error, opt_eventId) {
466-
// Only handles popup events of type sign in and which match popup event id.
466+
// Only handles popup events of type sign in and which match popup event ID.
467467
if (mode != fireauth.AuthEvent.Type.SIGN_IN_VIA_POPUP ||
468468
this.popupEventId_ != opt_eventId) {
469469
return;
@@ -492,7 +492,7 @@ fireauth.Auth.prototype.resolvePendingPopupEvent =
492492
* Returns the handler's appropriate popup and redirect sign in operation
493493
* finisher.
494494
* @param {!fireauth.AuthEvent.Type} mode The Auth type mode.
495-
* @param {?string=} opt_eventId The optional event id.
495+
* @param {?string=} opt_eventId The optional event ID.
496496
* @return {?function(string,
497497
* string):!goog.Promise<!fireauth.AuthEventManager.Result>}
498498
* @override
@@ -549,7 +549,7 @@ fireauth.Auth.prototype.finishPopupAndRedirectSignIn =
549549
var p = self.authStateLoaded_.then(function() {
550550
return idTokenResolver;
551551
}).then(function(idTokenResponse) {
552-
// Use ID token response to sign in the auth user.
552+
// Use ID token response to sign in the Auth user.
553553
return self.signInWithIdTokenResponse(idTokenResponse);
554554
}).then(function() {
555555
// On sign in success, construct redirect and popup result and return a
@@ -597,7 +597,7 @@ fireauth.Auth.prototype.signInWithPopup = function(provider) {
597597
// There could multiple sign in with popup events in different windows.
598598
// We need to match the correct popup to the correct pending promise.
599599
var eventId = this.generateEventId_();
600-
// If incapable of redirecting popup from opener, popup destination url
600+
// If incapable of redirecting popup from opener, popup destination URL
601601
// directly. This could also happen in a sandboxed iframe.
602602
var oauthHelperWidgetUrl = null;
603603
if ((!fireauth.util.runsInBackground() || fireauth.util.isIframe()) &&
@@ -730,7 +730,7 @@ fireauth.Auth.prototype.getRedirectResult = function() {
730730

731731
/**
732732
* Completes the headless sign in with the server response containing the STS
733-
* access and refresh tokens, and sets the auth user as current user while
733+
* access and refresh tokens, and sets the Auth user as current user while
734734
* setting all listeners to it and saving it to storage.
735735
* @param {!Object<string, string>} idTokenResponse The ID token response from
736736
* the server.
@@ -823,7 +823,7 @@ fireauth.Auth.prototype.signOut = function() {
823823
return /** @type {!fireauth.storage.UserManager} */ (
824824
self.userStorageManager_).removeCurrentUser()
825825
.then(function() {
826-
// Notify external auth listeners of this auth change event.
826+
// Notify external Auth listeners of this Auth change event.
827827
self.notifyAuthListeners_();
828828
});
829829
});
@@ -862,7 +862,7 @@ fireauth.Auth.prototype.initRedirectUser_ = function() {
862862

863863

864864
/**
865-
* Loads the initial auth state for current application from web storage and
865+
* Loads the initial Auth state for current application from web storage and
866866
* initializes Auth user accordingly to reflect that state. This routine does
867867
* not wait for any pending redirect result to be resolved.
868868
* @return {!goog.Promise<undefined>} Promise that resolves when state is ready,
@@ -934,7 +934,7 @@ fireauth.Auth.prototype.initAuthState_ = function() {
934934

935935
/**
936936
* After initial Auth state is loaded, waits for any pending redirect result,
937-
* resolves it and then adds the external auth state change listeners and
937+
* resolves it and then adds the external Auth state change listeners and
938938
* triggers first state of all observers.
939939
* @return {!goog.Promise<undefined>} Promise that resolves when state is ready
940940
* taking into account any pending redirect result.
@@ -954,7 +954,7 @@ fireauth.Auth.prototype.initAuthRedirectState_ = function() {
954954
if (self.deleted_) {
955955
return;
956956
}
957-
// Between init auth state and get redirect result resolution there
957+
// Between init Auth state and get redirect result resolution there
958958
// could have been a sign in attempt in another window.
959959
// Force sync and then add listener to run sync on change below.
960960
return self.getSyncAuthUserChanges_();
@@ -1149,7 +1149,7 @@ fireauth.Auth.prototype.attachEventListeners_ = function(user) {
11491149
fireauth.UserEventType.USER_INVALIDATED,
11501150
this.userInvalidatedListener_);
11511151
// Start proactive token refresh on new user if there is at least one
1152-
// Firebase service subscribed to auth changes.
1152+
// Firebase service subscribed to Auth changes.
11531153
if (this.firebaseServices_ > 0) {
11541154
user.startProactiveRefresh();
11551155
}
@@ -1230,14 +1230,14 @@ fireauth.Auth.prototype.initUserStateObserver_ = function(observer) {
12301230

12311231

12321232
/**
1233-
* Adds an observer for auth state changes, we need to wrap the call as
1233+
* Adds an observer for Auth state changes, we need to wrap the call as
12341234
* the args checking code needs a method defined on the prototype this way,
12351235
* not within the constructor, and we also have to implement the behavior
12361236
* that will trigger an observer right away if state is ready.
12371237
* @param {!firebase.Observer|function(?fireauth.AuthUser)}
12381238
* nextOrObserver An observer object or a function triggered on change.
12391239
* @param {function(!fireauth.AuthError)=} opt_error Optional A function
1240-
* triggered on auth error.
1240+
* triggered on Auth error.
12411241
* @param {function()=} opt_completed Optional A function triggered when the
12421242
* observer is removed.
12431243
* @return {!function()} The unsubscribe function for the observer.
@@ -1360,7 +1360,7 @@ fireauth.Auth.prototype.getIdTokenInternal = function(opt_forceRefresh) {
13601360
fireauth.Auth.prototype.signInWithCustomToken = function(token) {
13611361
var self = this;
13621362
// Wait for the redirect state to be determined before proceeding. If critical
1363-
// errors like web storage unsupported are detected, fail before rpc, instead
1363+
// errors like web storage unsupported are detected, fail before RPC, instead
13641364
// of after.
13651365
return this.redirectStateIsReady_.then(function() {
13661366
return self.signInWithIdTokenProvider_(
@@ -1388,7 +1388,7 @@ fireauth.Auth.prototype.signInWithEmailAndPassword =
13881388
function(email, password) {
13891389
var self = this;
13901390
// Wait for the redirect state to be determined before proceeding. If critical
1391-
// errors like web storage unsupported are detected, fail before rpc, instead
1391+
// errors like web storage unsupported are detected, fail before RPC, instead
13921392
// of after.
13931393
return this.redirectStateIsReady_.then(function() {
13941394
return self.signInWithIdTokenProvider_(
@@ -1409,7 +1409,7 @@ fireauth.Auth.prototype.createUserWithEmailAndPassword =
14091409
function(email, password) {
14101410
var self = this;
14111411
// Wait for the redirect state to be determined before proceeding. If critical
1412-
// errors like web storage unsupported are detected, fail before rpc, instead
1412+
// errors like web storage unsupported are detected, fail before RPC, instead
14131413
// of after.
14141414
return this.redirectStateIsReady_.then(function() {
14151415
return self.signInWithIdTokenProvider_(
@@ -1446,7 +1446,7 @@ fireauth.Auth.prototype.signInAndRetrieveDataWithCredential =
14461446
// decide how to retrieve ID token.
14471447
var self = this;
14481448
// Wait for the redirect state to be determined before proceeding. If critical
1449-
// errors like web storage unsupported are detected, fail before rpc, instead
1449+
// errors like web storage unsupported are detected, fail before RPC, instead
14501450
// of after.
14511451
return this.redirectStateIsReady_.then(function() {
14521452
// Return the full response object and not just the user.
@@ -1463,7 +1463,7 @@ fireauth.Auth.prototype.signInAndRetrieveDataWithCredential =
14631463
fireauth.Auth.prototype.signInAnonymously = function() {
14641464
var self = this;
14651465
// Wait for the redirect state to be determined before proceeding. If critical
1466-
// errors like web storage unsupported are detected, fail before rpc, instead
1466+
// errors like web storage unsupported are detected, fail before RPC, instead
14671467
// of after.
14681468
return this.redirectStateIsReady_.then(function() {
14691469
var user = self.currentUser_();
@@ -1494,7 +1494,7 @@ fireauth.Auth.prototype.signInAnonymously = function() {
14941494

14951495

14961496
/**
1497-
* @return {string} The key used for storing auth state.
1497+
* @return {string} The key used for storing Auth state.
14981498
*/
14991499
fireauth.Auth.prototype.getStorageKey = function() {
15001500
return fireauth.util.createStorageKey(
@@ -1514,7 +1514,7 @@ fireauth.Auth.prototype.app_ = function() {
15141514

15151515

15161516
/**
1517-
* @return {!fireauth.RpcHandler} The rpc handler.
1517+
* @return {!fireauth.RpcHandler} The RPC handler.
15181518
*/
15191519
fireauth.Auth.prototype.getRpcHandler = function() {
15201520
return this.rpcHandler_;

0 commit comments

Comments
 (0)