diff --git a/browser/base/content/browser-fxaccounts.js b/browser/base/content/browser-fxaccounts.js index 57e6560febd..24e6b482fc9 100644 --- a/browser/base/content/browser-fxaccounts.js +++ b/browser/base/content/browser-fxaccounts.js @@ -177,7 +177,7 @@ let gFxAccounts = { // If the user is signed into their Firefox account and we are not // currently in customization mode, show their email address. - fxAccounts.getSignedInUser().then(userData => { + let doUpdate = userData => { // Reset the button to its original state. this.button.setAttribute("label", defaultLabel); this.button.removeAttribute("tooltiptext"); @@ -194,6 +194,15 @@ let gFxAccounts = { this.button.setAttribute("tooltiptext", userData.email); } } + } + fxAccounts.getSignedInUser().then(userData => { + doUpdate(userData); + }).then(null, error => { + // This is most likely in tests, were we quickly log users in and out. + // The most likely scenario is a user logged out, so reflect that. + // Bug 995134 calls for better errors so we could retry if we were + // sure this was the failure reason. + doUpdate(null); }); }, diff --git a/services/fxaccounts/FxAccounts.jsm b/services/fxaccounts/FxAccounts.jsm index f74fdb12c8c..60ca3567227 100644 --- a/services/fxaccounts/FxAccounts.jsm +++ b/services/fxaccounts/FxAccounts.jsm @@ -669,6 +669,13 @@ FxAccountsInternal.prototype = { this.pollTimeRemaining = this.POLL_SESSION; if (!currentState.whenVerifiedDeferred) { currentState.whenVerifiedDeferred = Promise.defer(); + // This deferred might not end up with any handlers (eg, if sync + // is yet to start up.) This might cause "A promise chain failed to + // handle a rejection" messages, so add an error handler directly + // on the promise to log the error. + currentState.whenVerifiedDeferred.promise.then(null, err => { + log.info("the wait for user verification was stopped: " + err); + }); } }