summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-09-02 11:37:51 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-09-02 11:37:51 +0200
commit2781afdf950ec271a8f37016263e71da857895bb (patch)
tree9afdf2c1c88d4c81e006dd02690cb781c3731c46 /services
parent35f68645a333370bedebf093e62a685c2bdef902 (diff)
downloadUXP-2781afdf950ec271a8f37016263e71da857895bb.tar
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.gz
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.lz
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.xz
UXP-2781afdf950ec271a8f37016263e71da857895bb.zip
Remove FxA migrator.
This resolves #637
Diffstat (limited to 'services')
-rw-r--r--services/sync/Weave.js7
-rw-r--r--services/sync/modules/FxaMigrator.jsm99
-rw-r--r--services/sync/moz.build1
-rw-r--r--services/sync/tests/unit/test_fxa_migration.js117
-rw-r--r--services/sync/tests/unit/xpcshell.ini3
5 files changed, 0 insertions, 227 deletions
diff --git a/services/sync/Weave.js b/services/sync/Weave.js
index a414fa083..de131d08a 100644
--- a/services/sync/Weave.js
+++ b/services/sync/Weave.js
@@ -72,13 +72,6 @@ WeaveService.prototype = {
Ci.nsISupportsWeakReference]),
ensureLoaded: function () {
-#ifndef MC_PALEMOON
- // If we are loaded and not using FxA, load the migration module.
- if (!this.fxAccountsEnabled) {
- Cu.import("resource://services-sync/FxaMigrator.jsm");
- }
-#endif
-
Components.utils.import("resource://services-sync/main.js");
// Side-effect of accessing the service is that it is instantiated.
diff --git a/services/sync/modules/FxaMigrator.jsm b/services/sync/modules/FxaMigrator.jsm
deleted file mode 100644
index 735b60144..000000000
--- a/services/sync/modules/FxaMigrator.jsm
+++ /dev/null
@@ -1,99 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict;"
-
-// Note that this module used to supervise the step-by-step migration from
-// a legacy Sync account to a FxA-based Sync account. In bug 1205928, this
-// changed to automatically disconnect the legacy Sync account.
-
-const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "WeaveService", function() {
- return Cc["@mozilla.org/weave/service;1"]
- .getService(Components.interfaces.nsISupports)
- .wrappedJSObject;
-});
-
-XPCOMUtils.defineLazyModuleGetter(this, "Weave",
- "resource://services-sync/main.js");
-
-// We send this notification when we perform the disconnection. The browser
-// window will show a one-off notification bar.
-const OBSERVER_STATE_CHANGE_TOPIC = "fxa-migration:state-changed";
-
-const OBSERVER_TOPICS = [
- "xpcom-shutdown",
- "weave:eol",
-];
-
-function Migrator() {
- // Leave the log-level as Debug - Sync will setup log appenders such that
- // these messages generally will not be seen unless other log related
- // prefs are set.
- this.log.level = Log.Level.Debug;
-
- for (let topic of OBSERVER_TOPICS) {
- Services.obs.addObserver(this, topic, false);
- }
-}
-
-Migrator.prototype = {
- log: Log.repository.getLogger("Sync.SyncMigration"),
-
- finalize() {
- for (let topic of OBSERVER_TOPICS) {
- Services.obs.removeObserver(this, topic);
- }
- },
-
- observe(subject, topic, data) {
- this.log.debug("observed " + topic);
- switch (topic) {
- case "xpcom-shutdown":
- this.finalize();
- break;
-
- default:
- // this notification when configured with legacy Sync means we want to
- // disconnect
- if (!WeaveService.fxAccountsEnabled) {
- this.log.info("Disconnecting from legacy Sync");
- // Set up an observer for when the disconnection is complete.
- let observe;
- Services.obs.addObserver(observe = () => {
- this.log.info("observed that startOver is complete");
- Services.obs.removeObserver(observe, "weave:service:start-over:finish");
- // Send the notification for the UI.
- Services.obs.notifyObservers(null, OBSERVER_STATE_CHANGE_TOPIC, null);
- }, "weave:service:start-over:finish", false);
-
- // Do the disconnection.
- Weave.Service.startOver();
- }
- }
- },
-
- get learnMoreLink() {
- try {
- var url = Services.prefs.getCharPref("app.support.baseURL");
- } catch (err) {
- return null;
- }
- url += "sync-upgrade";
- let sb = Services.strings.createBundle("chrome://weave/locale/services/sync.properties");
- return {
- text: sb.GetStringFromName("sync.eol.learnMore.label"),
- href: Services.urlFormatter.formatURL(url),
- };
- },
-};
-
-// We expose a singleton
-this.EXPORTED_SYMBOLS = ["fxaMigrator"];
-var fxaMigrator = new Migrator();
diff --git a/services/sync/moz.build b/services/sync/moz.build
index 83c39274a..5e5de10b7 100644
--- a/services/sync/moz.build
+++ b/services/sync/moz.build
@@ -26,7 +26,6 @@ EXTRA_JS_MODULES['services-sync'] += [
'modules/browserid_identity.js',
'modules/collection_validator.js',
'modules/engines.js',
- 'modules/FxaMigrator.jsm',
'modules/identity.js',
'modules/jpakeclient.js',
'modules/keys.js',
diff --git a/services/sync/tests/unit/test_fxa_migration.js b/services/sync/tests/unit/test_fxa_migration.js
deleted file mode 100644
index 0ca770e28..000000000
--- a/services/sync/tests/unit/test_fxa_migration.js
+++ /dev/null
@@ -1,117 +0,0 @@
-// We change this pref before anything else initializes
-Services.prefs.setCharPref("identity.fxaccounts.auth.uri", "http://localhost");
-
-// Test the FxAMigration module
-Cu.import("resource://services-sync/FxaMigrator.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-
-// Set our username pref early so sync initializes with the legacy provider.
-Services.prefs.setCharPref("services.sync.username", "foo");
-// And ensure all debug messages end up being printed.
-Services.prefs.setCharPref("services.sync.log.appender.dump", "Debug");
-
-// Now import sync
-Cu.import("resource://services-sync/service.js");
-Cu.import("resource://services-sync/record.js");
-Cu.import("resource://services-sync/util.js");
-
-// And reset the username.
-Services.prefs.clearUserPref("services.sync.username");
-
-Cu.import("resource://testing-common/services/sync/utils.js");
-Cu.import("resource://testing-common/services/common/logging.js");
-Cu.import("resource://testing-common/services/sync/rotaryengine.js");
-
-const FXA_USERNAME = "someone@somewhere";
-
-// Utilities
-function promiseOneObserver(topic) {
- return new Promise((resolve, reject) => {
- let observer = function(subject, topic, data) {
- Services.obs.removeObserver(observer, topic);
- resolve({ subject: subject, data: data });
- }
- Services.obs.addObserver(observer, topic, false);
- });
-}
-
-function promiseStopServer(server) {
- return new Promise((resolve, reject) => {
- server.stop(resolve);
- });
-}
-
-
-// Helpers
-function configureLegacySync() {
- let engine = new RotaryEngine(Service);
- engine.enabled = true;
- Svc.Prefs.set("registerEngines", engine.name);
- Svc.Prefs.set("log.logger.engine.rotary", "Trace");
-
- let contents = {
- meta: {global: {engines: {rotary: {version: engine.version,
- syncID: engine.syncID}}}},
- crypto: {},
- rotary: {}
- };
-
- const USER = "foo";
- const PASSPHRASE = "abcdeabcdeabcdeabcdeabcdea";
-
- setBasicCredentials(USER, "password", PASSPHRASE);
-
- let onRequest = function(request, response) {
- // ideally we'd only do this while a legacy user is configured, but WTH.
- response.setHeader("x-weave-alert", JSON.stringify({code: "soft-eol"}));
- }
- let server = new SyncServer({onRequest: onRequest});
- server.registerUser(USER, "password");
- server.createContents(USER, contents);
- server.start();
-
- Service.serverURL = server.baseURI;
- Service.clusterURL = server.baseURI;
- Service.identity.username = USER;
- Service._updateCachedURLs();
-
- Service.engineManager._engines[engine.name] = engine;
-
- return [engine, server];
-}
-
-add_task(function *testMigrationUnlinks() {
-
- // when we do a .startOver we want the new provider.
- let oldValue = Services.prefs.getBoolPref("services.sync-testing.startOverKeepIdentity");
- Services.prefs.setBoolPref("services.sync-testing.startOverKeepIdentity", false);
-
- do_register_cleanup(() => {
- Services.prefs.setBoolPref("services.sync-testing.startOverKeepIdentity", oldValue)
- });
-
- // Arrange for a legacy sync user.
- let [engine, server] = configureLegacySync();
-
- // Start a sync - this will cause an EOL notification which the migrator's
- // observer will notice.
- let promiseMigration = promiseOneObserver("fxa-migration:state-changed");
- let promiseStartOver = promiseOneObserver("weave:service:start-over:finish");
- _("Starting sync");
- Service.sync();
- _("Finished sync");
-
- yield promiseStartOver;
- yield promiseMigration;
- // We should have seen the observer and Sync should no longer be configured.
- Assert.ok(!Services.prefs.prefHasUserValue("services.sync.username"));
-});
-
-function run_test() {
- initTestLogging();
- do_register_cleanup(() => {
- fxaMigrator.finalize();
- Svc.Prefs.resetBranch("");
- });
- run_next_test();
-}
diff --git a/services/sync/tests/unit/xpcshell.ini b/services/sync/tests/unit/xpcshell.ini
index 609003ce9..4c0f0e7b7 100644
--- a/services/sync/tests/unit/xpcshell.ini
+++ b/services/sync/tests/unit/xpcshell.ini
@@ -190,9 +190,6 @@ support-files = prefs_test_prefs_store.js
[test_warn_on_truncated_response.js]
[test_postqueue.js]
-# FxA migration
-[test_fxa_migration.js]
-
# Synced tabs.
[test_syncedtabs.js]