Remove fxAccountsEnabled checks.

Tag #812
This commit is contained in:
wolfbeast 2019-03-13 16:36:55 +01:00 • committed by Roy Tam
commit 77006c3f17
3 changed files with 13 additions and 56 deletions

View file

@ -93,14 +93,6 @@ var gSyncUI = {
// Returns a promise that resolves with true if Sync needs to be configured, // Returns a promise that resolves with true if Sync needs to be configured,
// false otherwise. // false otherwise.
_needsSetup() { _needsSetup() {
// If Sync is configured for FxAccounts then we do that promise-dance.
if (this.weaveService.fxAccountsEnabled) {
return fxAccounts.getSignedInUser().then(user => {
// We want to treat "account needs verification" as "needs setup".
return !(user && user.verified);
});
}
// We are using legacy sync - check that.
let firstSync = ""; let firstSync = "";
try { try {
firstSync = Services.prefs.getCharPref("services.sync.firstSync"); firstSync = Services.prefs.getCharPref("services.sync.firstSync");
@ -114,19 +106,9 @@ var gSyncUI = {
// to Sync needs to be verified, false otherwise. // to Sync needs to be verified, false otherwise.
_needsVerification() { _needsVerification() {
// For callers who care about the distinction between "needs setup" and // For callers who care about the distinction between "needs setup" and
// "needs verification" // "needs verification". Only for fxAccounts. XXX: remove this check.
if (this.weaveService.fxAccountsEnabled) { // Since we are configured for legacy Sync only, which has no verification
return fxAccounts.getSignedInUser().then(user => { // concept, just return false.
// If there is no user, they can't be in a "needs verification" state.
if (!user) {
return false;
}
return !user.verified;
});
}
// Otherwise we are configured for legacy Sync, which has no verification
// concept.
return Promise.resolve(false); return Promise.resolve(false);
}, },

View file

@ -14,13 +14,6 @@ var gSyncUtils = {
return this.bundle = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties"); return this.bundle = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
}, },
get fxAccountsEnabled() {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
return service.fxAccountsEnabled;
},
// opens in a new window if we're in a modal prefwindow world, in a new tab otherwise // opens in a new window if we're in a modal prefwindow world, in a new tab otherwise
_openLink: function (url) { _openLink: function (url) {
let thisDocEl = document.documentElement, let thisDocEl = document.documentElement,
@ -78,8 +71,7 @@ var gSyncUtils = {
}, },
get tosURL() { get tosURL() {
let root = this.fxAccountsEnabled ? "fxa." : ""; return Weave.Svc.Prefs.get("termsURL");
return Weave.Svc.Prefs.get(root + "termsURL");
}, },
openToS: function () { openToS: function () {
@ -87,8 +79,7 @@ var gSyncUtils = {
}, },
get privacyPolicyURL() { get privacyPolicyURL() {
let root = this.fxAccountsEnabled ? "fxa." : ""; return Weave.Svc.Prefs.get("privacyURL");
return Weave.Svc.Prefs.get(root + "privacyURL");
}, },
openPrivacyPolicy: function () { openPrivacyPolicy: function () {

View file

@ -92,19 +92,7 @@ var gSyncPane = {
} catch (e) {} } catch (e) {}
if (!username) { if (!username) {
this.page = FXA_PAGE_LOGGED_OUT; this.page = FXA_PAGE_LOGGED_OUT;
} else if (xps.fxAccountsEnabled) { } else {
// Use cached values while we wait for the up-to-date values
let cachedComputerName;
try {
cachedComputerName = Services.prefs.getCharPref("services.sync.client.name");
}
catch (e) {
cachedComputerName = "";
}
document.getElementById("fxaEmailAddress1").textContent = username;
this._populateComputerName(cachedComputerName);
this.page = FXA_PAGE_LOGGED_IN;
} else { // Old Sync
this.page = PAGE_HAS_ACCOUNT; this.page = PAGE_HAS_ACCOUNT;
} }
}, },
@ -388,17 +376,13 @@ var gSyncPane = {
.getService(Components.interfaces.nsISupports) .getService(Components.interfaces.nsISupports)
.wrappedJSObject; .wrappedJSObject;
if (service.fxAccountsEnabled) { let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
this._openAboutAccounts(); if (win)
} else { win.focus();
let win = Services.wm.getMostRecentWindow("Weave:AccountSetup"); else {
if (win) window.openDialog("chrome://browser/content/sync/setup.xul",
win.focus(); "weaveSetup", "centerscreen,chrome,resizable=no",
else { wizardType);
window.openDialog("chrome://browser/content/sync/setup.xul",
"weaveSetup", "centerscreen,chrome,resizable=no",
wizardType);
}
} }
}, },