зеркало из https://github.com/mozilla/gecko-dev.git
Bug 683254 - On startup with no network, sync icon spins endlessly. r=philikon
This commit is contained in:
Родитель
6476aa6f95
Коммит
9d1d4fa01c
|
@ -50,7 +50,8 @@ let gSyncUI = {
|
|||
"weave:service:start-over",
|
||||
"weave:ui:login:error",
|
||||
"weave:ui:sync:error",
|
||||
"weave:ui:sync:finish"],
|
||||
"weave:ui:sync:finish",
|
||||
"weave:ui:clear-error"],
|
||||
|
||||
_unloaded: false,
|
||||
|
||||
|
@ -207,9 +208,7 @@ let gSyncUI = {
|
|||
onLoginFinish: function SUI_onLoginFinish() {
|
||||
// Clear out any login failure notifications
|
||||
let title = this._stringBundle.GetStringFromName("error.login.title");
|
||||
Weave.Notifications.removeAll(title);
|
||||
|
||||
this.updateUI();
|
||||
this.clearError(title);
|
||||
},
|
||||
|
||||
onLoginError: function SUI_onLoginError() {
|
||||
|
@ -255,8 +254,7 @@ let gSyncUI = {
|
|||
},
|
||||
|
||||
onStartOver: function SUI_onStartOver() {
|
||||
Weave.Notifications.removeAll();
|
||||
this.updateUI();
|
||||
this.clearError();
|
||||
},
|
||||
|
||||
onQuotaNotice: function onQuotaNotice(subject, data) {
|
||||
|
@ -345,19 +343,22 @@ let gSyncUI = {
|
|||
syncButton.setAttribute("tooltiptext", lastSyncLabel);
|
||||
},
|
||||
|
||||
clearError: function SUI_clearError(errorString) {
|
||||
Weave.Notifications.removeAll(errorString);
|
||||
this.updateUI();
|
||||
},
|
||||
|
||||
onSyncFinish: function SUI_onSyncFinish() {
|
||||
let title = this._stringBundle.GetStringFromName("error.sync.title");
|
||||
|
||||
// Clear out sync failures on a successful sync
|
||||
Weave.Notifications.removeAll(title);
|
||||
this.clearError(title);
|
||||
|
||||
if (this._wasDelayed && Weave.Status.sync != Weave.NO_SYNC_NODE_FOUND) {
|
||||
title = this._stringBundle.GetStringFromName("error.sync.no_node_found.title");
|
||||
Weave.Notifications.removeAll(title);
|
||||
this.clearError(title);
|
||||
this._wasDelayed = false;
|
||||
}
|
||||
|
||||
this.updateUI();
|
||||
},
|
||||
|
||||
onSyncError: function SUI_onSyncError() {
|
||||
|
@ -484,6 +485,9 @@ let gSyncUI = {
|
|||
case "weave:notification:added":
|
||||
this.initNotifications();
|
||||
break;
|
||||
case "weave:ui:clear-error":
|
||||
this.clearError();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -494,6 +494,8 @@ let ErrorHandler = {
|
|||
this.resetFileLog(Svc.Prefs.get("log.appender.file.logOnError"),
|
||||
LOG_PREFIX_ERROR);
|
||||
Svc.Obs.notify("weave:ui:login:error");
|
||||
} else {
|
||||
Svc.Obs.notify("weave:ui:clear-error");
|
||||
}
|
||||
|
||||
this.dontIgnoreErrors = false;
|
||||
|
|
|
@ -613,24 +613,16 @@ add_test(function test_login_network_error() {
|
|||
Service.passphrase = "abcdeabcdeabcdeabcdeabcdea";
|
||||
Service.clusterURL = "http://localhost:8080/";
|
||||
|
||||
Svc.Obs.add("weave:ui:login:error", function() {
|
||||
do_throw("Should not get here!");
|
||||
});
|
||||
|
||||
// Test network errors are not reported.
|
||||
Svc.Obs.add("weave:service:login:error", function onUIUpdate() {
|
||||
Svc.Obs.remove("weave:service:login:error", onUIUpdate);
|
||||
Svc.Obs.add("weave:ui:clear-error", function onClearError() {
|
||||
Svc.Obs.remove("weave:ui:clear-error", onClearError);
|
||||
|
||||
// Wait until other login:error observers are called since
|
||||
// it may change Status.sync.
|
||||
Utils.nextTick(function() {
|
||||
do_check_eq(Status.login, LOGIN_FAILED_NETWORK_ERROR);
|
||||
do_check_eq(Status.login, LOGIN_FAILED_NETWORK_ERROR);
|
||||
|
||||
Service.startOver();
|
||||
Status.resetSync();
|
||||
Services.io.offline = false;
|
||||
run_next_test();
|
||||
});
|
||||
Service.startOver();
|
||||
Status.resetSync();
|
||||
Services.io.offline = false;
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
setLastSync(NON_PROLONGED_ERROR_DURATION);
|
||||
|
|
Загрузка…
Ссылка в новой задаче