From 0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 6 Oct 2018 06:57:51 +0200 Subject: Import Tycho weave client --- services/sync/Weave.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'services/sync/Weave.js') diff --git a/services/sync/Weave.js b/services/sync/Weave.js index de131d08a..d99c217c0 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -72,6 +72,13 @@ WeaveService.prototype = { Ci.nsISupportsWeakReference]), ensureLoaded: function () { + // XXX: We don't support FxA, so prevent migrator calls + // to the Sync server from this module! Don't load it. + // If we are loaded and not using FxA, load the migration module. + //if (!this.fxAccountsEnabled) { + // Cu.import("resource://services-sync/FxaMigrator.jsm"); + //} + Components.utils.import("resource://services-sync/main.js"); // Side-effect of accessing the service is that it is instantiated. @@ -96,11 +103,14 @@ WeaveService.prototype = { * Whether Firefox Accounts is enabled. * * @return bool + * + * This function is currently always returning false because we don't support + * the use of FxA/Sync-1.5 but do want to keep the code "just in case". */ get fxAccountsEnabled() { -#ifdef MC_PALEMOON + // Early exit: FxA not supported. return false; -#else + try { // Old sync guarantees '@' will never appear in the username while FxA // uses the FxA email address - so '@' is the flag we use. @@ -109,7 +119,6 @@ WeaveService.prototype = { } catch (_) { return true; // No username == only allow FxA to be configured. } -#endif }, /** @@ -123,7 +132,8 @@ WeaveService.prototype = { */ get enabled() { let prefs = Services.prefs.getBranch(SYNC_PREFS_BRANCH); - return prefs.prefHasUserValue("username"); + return prefs.prefHasUserValue("username") && + prefs.prefHasUserValue("clusterURL"); }, observe: function (subject, topic, data) { @@ -183,13 +193,10 @@ AboutWeaveLog.prototype = { channel.originalURI = aURI; // Ensure that the about page has the same privileges as a regular directory - // view. That way links to files can be opened. make sure we use the correct - // origin attributes when creating the principal for accessing the - // about:sync-log data. + // view. That way links to files can be opened. let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); - let principal = ssm.createCodebasePrincipal(uri, aLoadInfo.originAttributes); - + let principal = ssm.getNoAppCodebasePrincipal(uri); channel.owner = principal; return channel; } -- cgit v1.2.3 From 18473f1844a8230130e1fc23d7ebf7d33183316f Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 6 Oct 2018 07:09:02 +0200 Subject: Update sync client for JS changes. --- services/sync/Weave.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'services/sync/Weave.js') diff --git a/services/sync/Weave.js b/services/sync/Weave.js index d99c217c0..4c89aba13 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -72,13 +72,6 @@ WeaveService.prototype = { Ci.nsISupportsWeakReference]), ensureLoaded: function () { - // XXX: We don't support FxA, so prevent migrator calls - // to the Sync server from this module! Don't load it. - // If we are loaded and not using FxA, load the migration module. - //if (!this.fxAccountsEnabled) { - // Cu.import("resource://services-sync/FxaMigrator.jsm"); - //} - Components.utils.import("resource://services-sync/main.js"); // Side-effect of accessing the service is that it is instantiated. @@ -193,10 +186,13 @@ AboutWeaveLog.prototype = { channel.originalURI = aURI; // Ensure that the about page has the same privileges as a regular directory - // view. That way links to files can be opened. + // view. That way links to files can be opened. make sure we use the correct + // origin attributes when creating the principal for accessing the + // about:sync-log data. let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); - let principal = ssm.getNoAppCodebasePrincipal(uri); + let principal = ssm.createCodebasePrincipal(uri, aLoadInfo.originAttributes); + channel.owner = principal; return channel; } -- cgit v1.2.3 From eae3be4cfe133a86cc4175ebee9ce72055973b40 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sat, 6 Oct 2018 12:07:35 +0200 Subject: =?UTF-8?q?Make=20Everything=20Work=E2=84=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/sync/Weave.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'services/sync/Weave.js') diff --git a/services/sync/Weave.js b/services/sync/Weave.js index 4c89aba13..0e8d2fe31 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -103,7 +103,7 @@ WeaveService.prototype = { get fxAccountsEnabled() { // Early exit: FxA not supported. return false; - +/* -- commented out to prevent unreachable code warning -- try { // Old sync guarantees '@' will never appear in the username while FxA // uses the FxA email address - so '@' is the flag we use. @@ -112,6 +112,7 @@ WeaveService.prototype = { } catch (_) { return true; // No username == only allow FxA to be configured. } +*/ }, /** -- cgit v1.2.3 From b3586bb4b76e833d987eb207d1a17d7855439a60 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 30 Nov 2018 11:00:54 +0100 Subject: Remove telemetry calls from sync --- services/sync/Weave.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'services/sync/Weave.js') diff --git a/services/sync/Weave.js b/services/sync/Weave.js index 0e8d2fe31..ff97c2edd 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -155,10 +155,7 @@ WeaveService.prototype = { Components.utils.import("resource://services-sync/main.js"); isConfigured = Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED; } - let getHistogramById = Services.telemetry.getHistogramById; - getHistogramById("WEAVE_CONFIGURED").add(isConfigured); if (isConfigured) { - getHistogramById("WEAVE_CONFIGURED_MASTER_PASSWORD").add(Utils.mpEnabled()); this.ensureLoaded(); } }.bind(this) -- cgit v1.2.3 From 9c966a087fa5bf5e8f9a264234f4e4dfecbd6768 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 30 Nov 2018 11:15:22 +0100 Subject: Remove fxAccountsEnabled() --- services/sync/Weave.js | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'services/sync/Weave.js') diff --git a/services/sync/Weave.js b/services/sync/Weave.js index ff97c2edd..5bafa07ad 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -92,29 +92,6 @@ WeaveService.prototype = { return deferred.promise; }, - /** - * Whether Firefox Accounts is enabled. - * - * @return bool - * - * This function is currently always returning false because we don't support - * the use of FxA/Sync-1.5 but do want to keep the code "just in case". - */ - get fxAccountsEnabled() { - // Early exit: FxA not supported. - return false; -/* -- commented out to prevent unreachable code warning -- - try { - // Old sync guarantees '@' will never appear in the username while FxA - // uses the FxA email address - so '@' is the flag we use. - let username = Services.prefs.getCharPref(SYNC_PREFS_BRANCH + "username"); - return !username || username.includes('@'); - } catch (_) { - return true; // No username == only allow FxA to be configured. - } -*/ - }, - /** * Whether Sync appears to be enabled. * -- cgit v1.2.3