Bug 1593122 - "[autoconfig] Status area goes blank while running guess config" [r=mkmelin, ui-r=alessandro]
--- a/mail/components/accountcreation/content/emailWizard.js
+++ b/mail/components/accountcreation/content/emailWizard.js
@@ -621,21 +621,21 @@ EmailConfigWizard.prototype = {
var priority = (this._abortable = new PriorityOrderAbortable(
function(config, call) {
// success
self._abortable = null;
self.removeStatusLines();
self.stopSpinner(call.foundMsg);
self.foundConfig(config);
},
- function(e) {
+ function(e, allErrors) {
// all failed
self._abortable = null;
self.removeStatusLines();
- if (e instanceof CancelledException) {
+ if (allErrors.some(e => e instanceof CancelledException)) {
return;
}
// guess config
let initialConfig = new AccountConfig();
self._prefillConfig(initialConfig);
self._guessConfig(domain, initialConfig);
}
@@ -691,25 +691,28 @@ EmailConfigWizard.prototype = {
fetch = fetchConfigFromExchange(
domain,
emailAddress,
this._exchangeUsername,
this._password,
call.successCallback(),
(e, allErrors) => {
// Must call error callback in any case to stop the discover mode.
- call.errorCallback()(e); // ()(e) is correct
- if (
- e.code == 401 ||
- (allErrors && allErrors.find(e => e.code == 401))
- ) {
- // Auth failed
+ let errorCallback = call.errorCallback();
+ if (allErrors.some(e => e.code == 401)) {
+ // Auth failed.
// Ask user for username.
+ this.onStartOver();
+ this.stopSpinner(); // clears status message
_show("usernameRow");
- this.switchToMode("start");
+ _show("status-area");
+ _enable("manual-edit_button");
+ errorCallback(new CancelledException());
+ } else {
+ errorCallback(e);
}
}
);
call.setAbortable(fetch);
} catch (e) {
// e.g. when entering an invalid domain like "c@c.-com"
this.showErrorMsg(e);
this.removeStatusLines();