From c09487c09cb84621ebbc782653c0bc3827f3e1d6 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 30 Nov 2018 18:41:04 +0100 Subject: [BASILISK] Enable the "legacy" panels for the sync preferences. --- .../components/preferences/in-content/sync.js | 109 +-------------------- 1 file changed, 2 insertions(+), 107 deletions(-) (limited to 'application/basilisk/components/preferences/in-content/sync.js') diff --git a/application/basilisk/components/preferences/in-content/sync.js b/application/basilisk/components/preferences/in-content/sync.js index 27f7cd48c..364172d9b 100644 --- a/application/basilisk/components/preferences/in-content/sync.js +++ b/application/basilisk/components/preferences/in-content/sync.js @@ -306,113 +306,8 @@ var gSyncPane = { let service = Components.classes["@mozilla.org/weave/service;1"] .getService(Components.interfaces.nsISupports) .wrappedJSObject; - // service.fxAccountsEnabled is false iff sync is already configured for - // the legacy provider. - if (service.fxAccountsEnabled) { - let displayNameLabel = document.getElementById("fxaDisplayName"); - let fxaEmailAddress1Label = document.getElementById("fxaEmailAddress1"); - fxaEmailAddress1Label.hidden = false; - displayNameLabel.hidden = true; - - let profileInfoEnabled; - try { - profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled"); - } catch (ex) {} - - // determine the fxa status... - this._showLoadPage(service); - - fxAccounts.getSignedInUser().then(data => { - if (!data) { - this.page = FXA_PAGE_LOGGED_OUT; - return false; - } - this.page = FXA_PAGE_LOGGED_IN; - // We are logged in locally, but maybe we are in a state where the - // server rejected our credentials (eg, password changed on the server) - let fxaLoginStatus = document.getElementById("fxaLoginStatus"); - let syncReady; - // Not Verfied implies login error state, so check that first. - if (!data.verified) { - fxaLoginStatus.selectedIndex = FXA_LOGIN_UNVERIFIED; - syncReady = false; - // So we think we are logged in, so login problems are next. - // (Although if the Sync identity manager is still initializing, we - // ignore login errors and assume all will eventually be good.) - // LOGIN_FAILED_LOGIN_REJECTED explicitly means "you must log back in". - // All other login failures are assumed to be transient and should go - // away by themselves, so aren't reflected here. - } else if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) { - fxaLoginStatus.selectedIndex = FXA_LOGIN_FAILED; - syncReady = false; - // Else we must be golden (or in an error state we expect to magically - // resolve itself) - } else { - fxaLoginStatus.selectedIndex = FXA_LOGIN_VERIFIED; - syncReady = true; - } - fxaEmailAddress1Label.textContent = data.email; - document.getElementById("fxaEmailAddress2").textContent = data.email; - document.getElementById("fxaEmailAddress3").textContent = data.email; - this._populateComputerName(Weave.Service.clientsEngine.localName); - let engines = document.getElementById("fxaSyncEngines") - for (let checkbox of engines.querySelectorAll("checkbox")) { - checkbox.disabled = !syncReady; - } - document.getElementById("fxaChangeDeviceName").disabled = !syncReady; - - // Clear the profile image (if any) of the previously logged in account. - document.getElementById("fxaProfileImage").style.removeProperty("list-style-image"); - - // If the account is verified the next promise in the chain will - // fetch profile data. - return data.verified; - }).then(isVerified => { - if (isVerified) { - return fxAccounts.getSignedInUserProfile(); - } - return null; - }).then(data => { - let fxaLoginStatus = document.getElementById("fxaLoginStatus"); - if (data && profileInfoEnabled) { - if (data.displayName) { - fxaLoginStatus.setAttribute("hasName", true); - displayNameLabel.hidden = false; - displayNameLabel.textContent = data.displayName; - } else { - fxaLoginStatus.removeAttribute("hasName"); - } - if (data.avatar) { - let bgImage = "url(\"" + data.avatar + "\")"; - let profileImageElement = document.getElementById("fxaProfileImage"); - profileImageElement.style.listStyleImage = bgImage; - - let img = new Image(); - img.onerror = () => { - // Clear the image if it has trouble loading. Since this callback is asynchronous - // we check to make sure the image is still the same before we clear it. - if (profileImageElement.style.listStyleImage === bgImage) { - profileImageElement.style.removeProperty("list-style-image"); - } - }; - img.src = data.avatar; - } - } else { - fxaLoginStatus.removeAttribute("hasName"); - } - }, err => { - FxAccountsCommon.log.error(err); - }).catch(err => { - // If we get here something's really busted - Cu.reportError(String(err)); - }); - - // If fxAccountEnabled is false and we are in a "not configured" state, - // then fxAccounts is probably fully disabled rather than just unconfigured, - // so handle this case. This block can be removed once we remove support - // for fxAccounts being disabled. - } else if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED || - Weave.Svc.Prefs.get("firstSync", "") == "notReady") { + if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED || + Weave.Svc.Prefs.get("firstSync", "") == "notReady") { this.page = PAGE_NO_ACCOUNT; // else: sync was previously configured for the legacy provider, so we // make the "old" panels available. -- cgit v1.2.3