Bug 1081158 - ensure we report all login related errors. r=rnewman

This commit is contained in:
Mark Hammond 2015-03-05 16:12:51 +11:00
parent 714a802bc7
commit 6608577711
2 changed files with 24 additions and 0 deletions

View File

@ -737,6 +737,12 @@ ErrorHandler.prototype = {
return true;
}
if (Status.login == LOGIN_FAILED_LOGIN_REJECTED) {
// An explicit LOGIN_REJECTED state is always reported (bug 1081158)
this._log.trace("shouldReportError: true (login was rejected)");
return true;
}
let lastSync = Svc.Prefs.get("lastSync");
if (lastSync && ((Date.now() - Date.parse(lastSync)) >
Svc.Prefs.get("errorhandler.networkFailureReportTimeout") * 1000)) {

View File

@ -468,6 +468,24 @@ add_identity_test(this, function test_shouldReportError_master_password() {
yield deferred.promise;
});
// Test that even if we don't have a cluster URL, a login failure due to
// authentication errors is always reported.
add_identity_test(this, function test_shouldReportLoginFailureWithNoCluster() {
// Ensure no clusterURL - any error not specific to login should not be reported.
Service.serverURL = "";
Service.clusterURL = "";
// Test explicit "login rejected" state.
Status.resetSync();
// If we have a LOGIN_REJECTED state, we always report the error.
Status.login = LOGIN_FAILED_LOGIN_REJECTED;
do_check_true(errorHandler.shouldReportError());
// But any other status with a missing clusterURL is treated as a mid-sync
// 401 (ie, should be treated as a node reassignment)
Status.login = LOGIN_SUCCEEDED;
do_check_false(errorHandler.shouldReportError());
});
// XXX - how to arrange for 'Service.identity.basicPassword = null;' in
// an fxaccounts environment?
add_task(function test_login_syncAndReportErrors_non_network_error() {