зеркало из https://github.com/mozilla/gecko-dev.git
Bug 694311 - Return Sync UI to the disconnected state if login fails [r=mfinkle,philikon]
This commit is contained in:
Родитель
16bc0afb0e
Коммит
0a9e618b59
|
@ -1475,9 +1475,9 @@
|
|||
<method name="_getWeaveEngine">
|
||||
<body><![CDATA[
|
||||
// Return null if the Weave isn't ready
|
||||
if (document.getElementById("cmd_remoteTabs").getAttribute("disabled") == "true")
|
||||
if (document.getElementById("cmd_remoteTabs").getAttribute("disabled") == "true")
|
||||
return null;
|
||||
if (!Services.prefs.prefHasUserValue("services.sync.username")) {
|
||||
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED)
|
||||
return null;
|
||||
|
||||
return Weave.Engines.get("tabs");
|
||||
|
|
|
@ -1230,7 +1230,7 @@ var BrowserUI = {
|
|||
AwesomeScreen.activePanel = HistoryList;
|
||||
break;
|
||||
case "cmd_remoteTabs":
|
||||
if (!Services.prefs.prefHasUserValue("services.sync.username")) {
|
||||
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
|
||||
// We have to set activePanel before showing sync's dialog
|
||||
// to make the sure the dialog stacking is correct.
|
||||
AwesomeScreen.activePanel = RemoteTabsList;
|
||||
|
|
|
@ -101,7 +101,7 @@ Sanitizer.prototype = {
|
|||
|
||||
get canClear()
|
||||
{
|
||||
return (Services.prefs.prefHasUserValue("services.sync.username"));
|
||||
return (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ let WeaveGlue = {
|
|||
setupData: null,
|
||||
jpake: null,
|
||||
_bundle: null,
|
||||
_loginError: false,
|
||||
|
||||
init: function init() {
|
||||
if (this._bundle)
|
||||
|
@ -52,8 +53,7 @@ let WeaveGlue = {
|
|||
|
||||
this.setupData = { account: "", password: "" , synckey: "", serverURL: "" };
|
||||
|
||||
// Generating keypairs is expensive on mobile, so disable it
|
||||
if (Services.prefs.prefHasUserValue("services.sync.username")) {
|
||||
if (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED) {
|
||||
// Put the settings UI into a state of "connecting..." if we are going to auto-connect
|
||||
this._elements.connect.firstChild.disabled = true;
|
||||
this._elements.connect.setAttribute("title", this._bundle.GetStringFromName("connecting.label"));
|
||||
|
@ -259,7 +259,7 @@ let WeaveGlue = {
|
|||
|
||||
tryConnect: function login() {
|
||||
// If Sync is not configured, simply show the setup dialog
|
||||
if (!Services.prefs.prefHasUserValue("services.sync.username")) {
|
||||
if (this._loginError || Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
|
||||
this.open();
|
||||
return;
|
||||
}
|
||||
|
@ -343,6 +343,7 @@ let WeaveGlue = {
|
|||
"weave:service:sync:start", "weave:service:sync:finish",
|
||||
"weave:service:sync:error", "weave:service:login:start",
|
||||
"weave:service:login:finish", "weave:service:login:error",
|
||||
"weave:ui:login:error",
|
||||
"weave:service:logout:finish"];
|
||||
|
||||
// For each topic, add WeaveGlue the observer
|
||||
|
@ -397,7 +398,22 @@ let WeaveGlue = {
|
|||
let disconnect = this._elements.disconnect;
|
||||
let sync = this._elements.sync;
|
||||
|
||||
let isConfigured = Services.prefs.prefHasUserValue("services.sync.username");
|
||||
// Show what went wrong with login if necessary
|
||||
if (aTopic == "weave:ui:login:error") {
|
||||
this._loginError = true;
|
||||
connect.setAttribute("desc", Weave.Utils.getErrorString(Weave.Status.login));
|
||||
} else {
|
||||
connect.removeAttribute("desc");
|
||||
}
|
||||
|
||||
if (aTopic == "weave:service:login:finish") {
|
||||
this._loginError = false;
|
||||
// Init the setup data if we just logged in
|
||||
if (!this.setupData)
|
||||
this.loadSetupData();
|
||||
}
|
||||
|
||||
let isConfigured = (!this._loginError && Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED);
|
||||
|
||||
connect.collapsed = isConfigured;
|
||||
connected.collapsed = !isConfigured;
|
||||
|
@ -441,20 +457,6 @@ let WeaveGlue = {
|
|||
sync.setAttribute("title", dateStr);
|
||||
}
|
||||
|
||||
// Show what went wrong with login if necessary
|
||||
if (aTopic == "weave:service:login:error") {
|
||||
if (Weave.Status.login == Weave.MASTER_PASSWORD_LOCKED)
|
||||
Weave.Service.logout();
|
||||
else
|
||||
connect.setAttribute("desc", Weave.Utils.getErrorString(Weave.Status.login));
|
||||
} else {
|
||||
connect.removeAttribute("desc");
|
||||
}
|
||||
|
||||
// Init the setup data if we just logged in
|
||||
if (!this.setupData && aTopic == "weave:service:login:finish")
|
||||
this.loadSetupData();
|
||||
|
||||
// Check for a storage format update, update the user and load the Sync update page
|
||||
if (aTopic =="weave:service:sync:error") {
|
||||
let clientOutdated = false, remoteOutdated = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче