Backed out changeset 240237473d9e (bug 1463624) for failing eslint at builds/worker/checkouts/gecko/services/sync/tests/unit/test_browserid_identity.js:279:9 on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Thu, 24 May 2018 03:04:36 +0300
changeset 419623 b02b8c14d5b1fbf368e2580d75005f0753c1daed
parent 419622 240237473d9e7c87000a10f8985f673fa409a615
child 419624 7d3f94ce410966f5255201cfaa0cf3cc51c7f597
push id34040
push userebalazs@mozilla.com
push dateThu, 24 May 2018 09:37:05 +0000
treeherdermozilla-central@c411ccb6bb4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1463624
milestone62.0a1
backs out240237473d9e7c87000a10f8985f673fa409a615
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
Backed out changeset 240237473d9e (bug 1463624) for failing eslint at builds/worker/checkouts/gecko/services/sync/tests/unit/test_browserid_identity.js:279:9 on a CLOSED TREE
services/sync/modules/browserid_identity.js
services/sync/tests/unit/test_browserid_identity.js
--- a/services/sync/modules/browserid_identity.js
+++ b/services/sync/modules/browserid_identity.js
@@ -219,46 +219,48 @@ this.BrowserIDManager.prototype = {
     this._token = null;
   },
 
   async observe(subject, topic, data) {
     this._log.debug("observed " + topic);
     switch (topic) {
     case fxAccountsCommon.ONLOGIN_NOTIFICATION: {
       this._log.info("A user has logged in");
+      // If our existing Sync state is that we needed to reauth, clear that
+      // state now - it will get reset back if a problem persists.
+      if (Weave.Status.login == LOGIN_FAILED_LOGIN_REJECTED) {
+        Weave.Status.login = LOGIN_SUCCEEDED;
+      }
       this.resetCredentials();
       let accountData = await this._fxaService.getSignedInUser();
       this._updateSignedInUser(accountData);
 
       if (!accountData.verified) {
         // wait for a verified notification before we kick sync off.
         this._log.info("The user is not verified");
         break;
       }
-      // intentional fall-through - the user is verified.
     }
     // We've been configured with an already verified user, so fall-through.
     case fxAccountsCommon.ONVERIFIED_NOTIFICATION: {
       this._log.info("The user became verified");
 
       // Set the username now - that will cause Sync to know it is configured
       let accountData = await this._fxaService.getSignedInUser();
       this.username = accountData.email;
-      Weave.Status.login = LOGIN_SUCCEEDED;
 
       // And actually sync. If we've never synced before, we force a full sync.
       // If we have, then we are probably just reauthenticating so it's a normal sync.
-      // We can use any pref that must be set if we've synced before, and check
-      // the sync lock state because we might already be doing that first sync.
-      let isFirstSync = !Weave.Service.locked && !Svc.Prefs.get("client.syncID", null);
+      // We can use any pref that must be set if we've synced before.
+      let isFirstSync = !Svc.Prefs.get("client.syncID", null);
       if (isFirstSync) {
         this._log.info("Doing initial sync actions");
         Svc.Prefs.set("firstSync", "resetClient");
-        Services.obs.notifyObservers(null, "weave:service:setup-complete");
       }
+      Services.obs.notifyObservers(null, "weave:service:setup-complete");
       // There's no need to wait for sync to complete and it would deadlock
       // our AsyncObserver.
       Weave.Service.sync({why: "login"});
       break;
     }
 
     case fxAccountsCommon.ONLOGOUT_NOTIFICATION:
       Weave.Service.startOver().then(() => {
--- a/services/sync/tests/unit/test_browserid_identity.js
+++ b/services/sync/tests/unit/test_browserid_identity.js
@@ -260,44 +260,16 @@ add_task(async function test_ensureLogge
     /Can't possibly get keys; User is not signed in/, "expecting rejection due to no user");
   // Restore the logged in user to what it was.
   fxa.internal.currentAccountState.storageManager.accountData = signedInUser;
   Status.login = LOGIN_FAILED_LOGIN_REJECTED;
   await globalBrowseridManager._ensureValidToken();
   Assert.equal(Status.login, LOGIN_SUCCEEDED, "final ensureLoggedIn worked");
 });
 
-add_task(async function test_syncState() {
-  // Avoid polling for an unverified user.
-  let identityConfig = makeIdentityConfig();
-  let fxaInternal = makeFxAccountsInternalMock(identityConfig);
-  fxaInternal.startVerifiedCheck = () => {};
-  configureFxAccountIdentity(globalBrowseridManager, globalIdentityConfig, fxaInternal);
-
-  // arrange for no logged in user.
-  let fxa = globalBrowseridManager._fxaService;
-  let signedInUser = fxa.internal.currentAccountState.storageManager.accountData;
-  fxa.internal.currentAccountState.storageManager.accountData = null;
-  await Assert.rejects(globalBrowseridManager._ensureValidToken(true), "expecting rejection due to no user");
-  // Restore to an unverified user.
-  signedInUser.verified = false;
-  fxa.internal.currentAccountState.storageManager.accountData = signedInUser;
-  Status.login = LOGIN_FAILED_LOGIN_REJECTED;
-  // The browserid_identity observers are async, so call them directly.
-  await globalBrowseridManager.observe(null, ONLOGIN_NOTIFICATION, "");
-  Assert.equal(Status.login, LOGIN_FAILED_LOGIN_REJECTED,
-               "should not have changed the login state for an unverified user");
-
-  // now pretend the user because verified.
-  signedInUser.verified = true;
-  await globalBrowseridManager.observe(null, ONVERIFIED_NOTIFICATION, "");
-  Assert.equal(Status.login, LOGIN_SUCCEEDED,
-               "should have changed the login state to success");
-});
-
 add_task(async function test_tokenExpiration() {
     _("BrowserIDManager notices token expiration:");
     let bimExp = new BrowserIDManager();
     configureFxAccountIdentity(bimExp, globalIdentityConfig);
 
     let authenticator = bimExp.getResourceAuthenticator();
     Assert.ok(!!authenticator);
     let req = {uri: CommonUtils.makeURI(