Bug 982848: Don't clear syncKeyBundle in BrowserID Identity manager during failures to fetch token. r=markh
authorChris Karlof <ckarlof@mozilla.com>
Wed, 12 Mar 2014 14:31:18 -0700
changeset 191544 58252ac4f28d9f7c816191ee95ffb5473bd28810
parent 191543 c8a1458bfe7db00180abaf6932f0e232c7219fb1
child 191545 e41244dad384dbd447cace825f5eddbc2c2b921b
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs982848
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 982848: Don't clear syncKeyBundle in BrowserID Identity manager during failures to fetch token. r=markh
services/sync/modules/browserid_identity.js
--- a/services/sync/modules/browserid_identity.js
+++ b/services/sync/modules/browserid_identity.js
@@ -130,17 +130,17 @@ this.BrowserIDManager.prototype = {
    */
   ensureLoggedIn: function() {
     if (!this._shouldHaveSyncKeyBundle) {
       // We are already in the process of logging in.
       return this.whenReadyToAuthenticate.promise;
     }
 
     // If we are already happy then there is nothing more to do.
-    if (Weave.Status.login == LOGIN_SUCCEEDED) {
+    if (this._syncKeyBundle) {
       return Promise.resolve();
     }
 
     // Similarly, if we have a previous failure that implies an explicit
     // re-entering of credentials by the user is necessary we don't take any
     // further action - an observer will fire when the user does that.
     if (Weave.Status.login == LOGIN_FAILED_LOGIN_REJECTED) {
       return Promise.reject();
@@ -508,17 +508,16 @@ this.BrowserIDManager.prototype = {
           this._log.error("Non-authentication error in _fetchTokenForUser: " + err.message);
           // for now assume it is just a transient network related problem.
           this._authFailureReason = LOGIN_FAILED_NETWORK_ERROR;
         }
         // Drop the sync key bundle, but still expect to have one.
         // This will arrange for us to be in the right 'currentAuthState'
         // such that UI will show the right error.
         this._shouldHaveSyncKeyBundle = true;
-        this._syncKeyBundle = null;
         Weave.Status.login = this._authFailureReason;
         Services.obs.notifyObservers(null, "weave:service:login:error", null);
         throw err;
       });
   },
 
   // Returns a promise that is resolved when we have a valid token for the
   // current user stored in this._token.  When resolved, this._token is valid.