Bug 996027 - Ensure that TPS always fakes login into Weave. r=rnewman DONTBUILD

This commit is contained in:
Henrik Skupin 2014-04-14 18:22:23 +02:00
parent 0f340e34ff
commit b8f85e3a20
3 changed files with 21 additions and 6 deletions

View File

@ -79,9 +79,18 @@ var Authentication = {
});
try {
return cb.wait();
cb.wait();
if (Weave.Status.login !== Weave.LOGIN_SUCCEEDED) {
Logger.logInfo("Logging into Weave.");
Weave.Service.login();
Logger.AssertEqual(Weave.Status.login, Weave.LOGIN_SUCCEEDED,
"Weave logged in");
}
return true;
} catch (error) {
throw new Error("signIn() failed with: " + JSON.stringify(error));
throw new Error("signIn() failed with: " + error.message);
}
}
};

View File

@ -68,9 +68,16 @@ var Authentication = {
Weave.Service.identity.basicPassword = account["password"];
Weave.Service.identity.syncKey = account["passphrase"];
// Fake the login
Weave.Service.login();
Weave.Svc.Obs.notify("weave:service:setup-complete");
if (Weave.Status.login !== Weave.LOGIN_SUCCEEDED) {
Logger.logInfo("Logging into Weave.");
Weave.Service.login();
Logger.AssertEqual(Weave.Status.login, Weave.LOGIN_SUCCEEDED,
"Weave logged in");
// Bug 997279: Temporary workaround until we can ensure that Sync itself
// sends this notification for the first login attempt by TPS
Weave.Svc.Obs.notify("weave:service:setup-complete");
}
return true;
}

View File

@ -837,7 +837,6 @@ let TPS = {
let account = this.fxaccounts_enabled ? this.config.fx_account
: this.config.sync_account;
Authentication.signIn(account);
this.waitForSetupComplete();
Logger.AssertEqual(Weave.Status.service, Weave.STATUS_OK, "Weave status OK");
this.waitForTracking();