diff options
-rw-r--r-- | application/basilisk/base/content/browser-fxaccounts.js | 48 | ||||
-rw-r--r-- | services/sync/Weave.js | 7 | ||||
-rw-r--r-- | services/sync/modules/FxaMigrator.jsm | 99 | ||||
-rw-r--r-- | services/sync/moz.build | 1 | ||||
-rw-r--r-- | services/sync/tests/unit/test_fxa_migration.js | 117 | ||||
-rw-r--r-- | services/sync/tests/unit/xpcshell.ini | 3 |
6 files changed, 0 insertions, 275 deletions
diff --git a/application/basilisk/base/content/browser-fxaccounts.js b/application/basilisk/base/content/browser-fxaccounts.js index 0bbce3e26..94a591f1e 100644 --- a/application/basilisk/base/content/browser-fxaccounts.js +++ b/application/basilisk/base/content/browser-fxaccounts.js @@ -4,8 +4,6 @@ var gFxAccounts = { - SYNC_MIGRATION_NOTIFICATION_TITLE: "fxa-migration", - _initialized: false, _inCustomizationMode: false, _cachedProfile: null, @@ -26,7 +24,6 @@ var gFxAccounts = { "weave:service:setup-complete", "weave:service:sync:error", "weave:ui:login:error", - "fxa-migration:state-changed", this.FxAccountsCommon.ONLOGIN_NOTIFICATION, this.FxAccountsCommon.ONLOGOUT_NOTIFICATION, this.FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION, @@ -122,9 +119,6 @@ var gFxAccounts = { observe: function (subject, topic, data) { switch (topic) { - case "fxa-migration:state-changed": - this.onMigrationStateChanged(data, subject); - break; case this.FxAccountsCommon.ON_PROFILE_CHANGE_NOTIFICATION: this._cachedProfile = null; // Fallthrough intended @@ -134,48 +128,6 @@ var gFxAccounts = { } }, - onMigrationStateChanged: function () { - // Since we nuked most of the migration code, this notification will fire - // once after legacy Sync has been disconnected (and should never fire - // again) - let nb = window.document.getElementById("global-notificationbox"); - - let msg = this.strings.GetStringFromName("autoDisconnectDescription") - let signInLabel = this.strings.GetStringFromName("autoDisconnectSignIn.label"); - let signInAccessKey = this.strings.GetStringFromName("autoDisconnectSignIn.accessKey"); - let learnMoreLink = this.fxaMigrator.learnMoreLink; - - let buttons = [ - { - label: signInLabel, - accessKey: signInAccessKey, - callback: () => { - this.openPreferences(); - } - } - ]; - - let fragment = document.createDocumentFragment(); - let msgNode = document.createTextNode(msg); - fragment.appendChild(msgNode); - if (learnMoreLink) { - let link = document.createElement("label"); - link.className = "text-link"; - link.setAttribute("value", learnMoreLink.text); - link.href = learnMoreLink.href; - fragment.appendChild(link); - } - - nb.appendNotification(fragment, - this.SYNC_MIGRATION_NOTIFICATION_TITLE, - undefined, - nb.PRIORITY_WARNING_LOW, - buttons); - - // ensure the hamburger menu reflects the newly disconnected state. - this.updateAppMenuItem(); - }, - handleEvent: function (event) { this._inCustomizationMode = event.type == "customizationstarting"; this.updateAppMenuItem(); 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] |