Bug 1031580 - FxA fires ONLOGIN only for calling RP. r=jedp, a=2.0+
authorSam Penrose <spenrose@mozilla.com>
Tue, 01 Jul 2014 10:31:17 -0700
changeset 207594 0e7a7d248e400db0326339523fc4f1c853df1d5d
parent 207593 c963ceaae67759cabebcd88c0ddcce9a55631492
child 207595 e2b455dd98dc55f333974ff5954ea1e8a01534fb
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjedp, 2
bugs1031580
milestone32.0a2
Bug 1031580 - FxA fires ONLOGIN only for calling RP. r=jedp, a=2.0+
services/fxaccounts/FxAccountsManager.jsm
--- a/services/fxaccounts/FxAccountsManager.jsm
+++ b/services/fxaccounts/FxAccountsManager.jsm
@@ -133,16 +133,25 @@ this.FxAccountsManager = {
             user: user
           });
         }
 
         // If the user object includes an email field, it may differ in
         // capitalization from what we sent down.  This is the server's
         // canonical capitalization and should be used instead.
         user.email = user.email || aEmail;
+
+        // If we're using server-side sign to refreshAuthentication
+        // we don't need to update local state; also because of two
+        // interacting glitches we need to bypass an event emission.
+        // See https://bugzilla.mozilla.org/show_bug.cgi?id=1031580
+        if (this._refreshing) {
+          return Promise.resolve({user: this._user});
+        }
+
         return this._fxAccounts.setSignedInUser(user).then(
           () => {
             this._activeSession = user;
             log.debug("User signed in: " + JSON.stringify(this._user) +
                       " - Account created " + (aMethod == "signUp"));
             return Promise.resolve({
               accountCreated: aMethod === "signUp",
               user: this._user