Bug 1588358 - Untangle suite profile and migration source and clean it up. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sun, 20 Oct 2019 17:40:58 +0200
changeset 37186 2abc5e2495fc83ffa438def667bac604c4b8be22
parent 37185 8c7735bd0dc3e7ace3f860df8749e4948227a8b4
child 37187 01dcc0cc8f07406220436186fd13c22d56380916
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersIanN
bugs1588358
Bug 1588358 - Untangle suite profile and migration source and clean it up. r=IanN
suite/components/build/moz.build
suite/components/build/nsSuiteModule.cpp
suite/components/migration/SuiteProfileMigrator.js
suite/components/migration/SuiteProfileMigrator.manifest
suite/components/migration/content/migration.js
suite/components/migration/content/migration.xul
suite/components/migration/jar.mn
suite/components/migration/moz.build
suite/components/migration/public/moz.build
suite/components/migration/public/nsISuiteProfileMigrator.idl
suite/components/migration/public/nsSuiteMigrationCID.h
suite/components/migration/src/moz.build
suite/components/migration/src/nsSuiteProfileMigratorBase.cpp
suite/components/migration/src/nsSuiteProfileMigratorBase.h
suite/components/migration/src/nsSuiteProfileMigratorUtils.cpp
suite/components/migration/src/nsSuiteProfileMigratorUtils.h
suite/components/migration/src/nsThunderbirdProfileMigrator.cpp
suite/components/migration/src/nsThunderbirdProfileMigrator.h
suite/components/moz.build
suite/components/profile/SuiteProfileMigrator.js
suite/components/profile/SuiteProfileMigrator.manifest
suite/components/profile/content/migration.js
suite/components/profile/content/migration.xul
suite/components/profile/content/profileSelection.js
suite/components/profile/jar.mn
suite/components/profile/moz.build
suite/components/profile/nsISuiteProfileMigrator.idl
suite/components/profile/nsNetscapeProfileMigratorBase.cpp
suite/components/profile/nsNetscapeProfileMigratorBase.h
suite/components/profile/nsSuiteProfileMigratorUtils.cpp
suite/components/profile/nsSuiteProfileMigratorUtils.h
suite/components/profile/nsThunderbirdProfileMigrator.cpp
suite/components/profile/nsThunderbirdProfileMigrator.h
--- a/suite/components/build/moz.build
+++ b/suite/components/build/moz.build
@@ -12,11 +12,12 @@ SOURCES += [
     'nsSuiteModule.cpp',
 ]
 
 Library('suite')
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../feeds',
+    '../migration/src',
     '../profile',
     '../shell',
 ]
--- a/suite/components/build/nsSuiteModule.cpp
+++ b/suite/components/build/nsSuiteModule.cpp
@@ -1,29 +1,28 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
 #include "mozilla/ModuleUtils.h"
 #include "nsSuiteDirectoryProvider.h"
 #include "nsThunderbirdProfileMigrator.h"
+#include "nsSuiteMigrationCID.h"
 #include "nsNetCID.h"
 #include "nsFeedSniffer.h"
 
 #if defined(XP_WIN)
 #include "nsWindowsShellService.h"
 #elif defined(XP_MACOSX)
 #include "nsMacShellService.h"
 #elif defined(MOZ_WIDGET_GTK)
 #include "nsGNOMEShellService.h"
 #endif
 
-#define NS_SUITEPROFILEMIGRATOR_CONTRACTID_PREFIX "@mozilla.org/profile/migrator;1?app=suite&type="
-
 using namespace mozilla;
 /////////////////////////////////////////////////////////////////////////////
 
 #if defined(XP_WIN)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsShellService, Init)
 #elif defined(XP_MACOSX)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
 #elif defined(MOZ_WIDGET_GTK)
rename from suite/components/profile/SuiteProfileMigrator.js
rename to suite/components/migration/SuiteProfileMigrator.js
--- a/suite/components/profile/SuiteProfileMigrator.js
+++ b/suite/components/migration/SuiteProfileMigrator.js
@@ -2,16 +2,20 @@
  * 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";
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 const {FileUtils} = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
+const {AppConstants} = ChromeUtils.import('resource://gre/modules/AppConstants.jsm');
++
+ChromeUtils.defineModuleGetter(this, "FileUtils",
+  "resource://gre/modules/FileUtils.jsm");
 
 function ProfileMigrator() {
 }
 
 ProfileMigrator.prototype = {
   migrate: function PM_migrate(aStartup) {
     // By opening the wizard with a supplied migrator, it will automatically
     // migrate from it.
@@ -29,103 +33,110 @@ ProfileMigrator.prototype = {
                            "chrome://communicator/content/migration/migration.xul",
                            "_blank",
                            "chrome,dialog,modal,centerscreen,titlebar",
                            params);
   },
 
   _toString: function PM__toString(aStr) {
     let str = Cc["@mozilla.org/supports-string;1"]
-                         .createInstance(Ci.nsISupportsString);
+                .createInstance(Ci.nsISupportsString);
     str.data = aStr;
     return str;
   },
 
   _getMigratorIfSourceExists: function PM__getMigratorIfSourceExists(aKey) {
     let cid = "@mozilla.org/profile/migrator;1?app=suite&type=" + aKey;
-    let migrator = Cc[cid]
-                     .createInstance(Ci
-                                               .nsISuiteProfileMigrator);
+    let migrator = Cc[cid].createInstance(Ci.nsISuiteProfileMigrator);
     if (migrator.sourceExists)
       return migrator;
     return null;
   },
 
   // We don't yet support checking for the default browser on all platforms,
   // needless to say we don't have migrators for all browsers.  Thus, for each
   // platform, there's a fallback list of migrators used in these cases.
   _PLATFORM_FALLBACK_LIST:
      ["thunderbird"],
 
   _getDefaultMigrator: function PM__getDefaultMigrator() {
+
     let migratorsOrdered = Array.from(this._PLATFORM_FALLBACK_LIST);
-#if 0
-    let defaultBrowser = "";
-#ifdef XP_WIN
-    try {
-      const REG_KEY = "SOFTWARE\\Classes\\HTTP\\shell\\open\\command";
-      let regKey = Cc["@mozilla.org/windows-registry-key;1"]
-                     .createInstance(Ci.nsIWindowsRegKey);
-      regKey.open(regKey.ROOT_KEY_LOCAL_MACHINE, REG_KEY,
-                  regKey.ACCESS_READ);
-      let value = regKey.readStringValue("").toLowerCase();
-      let pathMatches = value.match(/^"?(.+?\.exe)"?/);
-      if (!pathMatches) {
-        throw new Error("Could not extract path from " +
-                        REG_KEY + "(" + value + ")");
+
+    // FIXME This is all so not working currently.
+    // There are currently no migrators for browsers available.
+    // See Bug 739056.
+    if (false) {
+      let defaultBrowser = "";
+
+      if (AppConstants.platform == "win") {
+        try {
+          const REG_KEY = "SOFTWARE\\Classes\\HTTP\\shell\\open\\command";
+          let regKey = Cc["@mozilla.org/windows-registry-key;1"]
+                         .createInstance(Ci.nsIWindowsRegKey);
+          regKey.open(regKey.ROOT_KEY_LOCAL_MACHINE, REG_KEY,
+                      regKey.ACCESS_READ);
+          let value = regKey.readStringValue("").toLowerCase();
+          let pathMatches = value.match(/^"?(.+?\.exe)"?/);
+          if (!pathMatches) {
+            throw new Error("Could not extract path from " +
+                            REG_KEY + "(" + value + ")");
+          }
+
+          // We want to find out what the default browser is but the path in and of
+          // itself isn't enough.  Why? Because sometimes on Windows paths get
+          // truncated like so: C:\PROGRA~1\MOZILL~2\MOZILL~1.EXE.  How do we know
+          // what product that is? Mozilla's file objects do nothing to 'normalize'
+          // the path so we need to attain an actual product descriptor from the
+          // file somehow, and in this case it means getting the "InternalName"
+          // field of the file's VERSIONINFO resource.
+          //
+          // In the file's resource segment there is a VERSIONINFO section that is
+          // laid out like this:
+          //
+          // VERSIONINFO
+          //   StringFileInfo
+          //     <TranslationID>
+          //       InternalName           "iexplore"
+          //   VarFileInfo
+          //     Translation              <TranslationID>
+          //
+          // By Querying the VERSIONINFO section for its Tranlations, we can find
+          // out where the InternalName lives (A file can have more than one
+          // translation of its VERSIONINFO segment, but we just assume the first
+          // one).
+          let file = FileUtils.File(pathMatches[1])
+                              .QueryInterface(Ci.nsILocalFileWin);
+          switch (file.getVersionInfoField("InternalName").toLowerCase()) {
+            case "iexplore":
+              defaultBrowser = "ie";
+              break;
+            case "chrome":
+              defaultBrowser = "chrome";
+              break;
+          }
+        }
+        catch (ex) {
+          Cu.reportError("Could not retrieve default browser: " + ex);
+        }
       }
 
-      // We want to find out what the default browser is but the path in and of
-      // itself isn't enough.  Why? Because sometimes on Windows paths get
-      // truncated like so: C:\PROGRA~1\MOZILL~2\MOZILL~1.EXE.  How do we know
-      // what product that is? Mozilla's file objects do nothing to 'normalize'
-      // the path so we need to attain an actual product descriptor from the
-      // file somehow, and in this case it means getting the "InternalName"
-      // field of the file's VERSIONINFO resource.
-      //
-      // In the file's resource segment there is a VERSIONINFO section that is
-      // laid out like this:
-      //
-      // VERSIONINFO
-      //   StringFileInfo
-      //     <TranslationID>
-      //       InternalName           "iexplore"
-      //   VarFileInfo
-      //     Translation              <TranslationID>
-      //
-      // By Querying the VERSIONINFO section for its Tranlations, we can find
-      // out where the InternalName lives (A file can have more than one
-      // translation of its VERSIONINFO segment, but we just assume the first
-      // one).
-      let file = FileUtils.File(pathMatches[1])
-                          .QueryInterface(Ci.nsILocalFileWin);
-      switch (file.getVersionInfoField("InternalName").toLowerCase()) {
-        case "iexplore":
-          defaultBrowser = "ie";
-          break;
-        case "chrome":
-          defaultBrowser = "chrome";
-          break;
+      // If we found the default browser and we have support for that browser,
+      // make sure to check it before any other browser, by moving it to the head
+      // of the array.
+      if (defaultBrowser) {
+        migratorsOrdered.sort((a, b) => b == defaultBrowser ? 1 : 0); 
       }
     }
-    catch (ex) {
-      Cu.reportError("Could not retrieve default browser: " + ex);
-    }
-#endif
 
-    // If we found the default browser and we have support for that browser,
-    // make sure to check it before any other browser, by moving it to the head
-    // of the array.
-    if (defaultBrowser)
-      migratorsOrdered.sort((a, b) => b == defaultBrowser ? 1 : 0);
-#endif
     for (let key of migratorsOrdered) {
       let migrator = this._getMigratorIfSourceExists(key);
-      if (migrator)
+      if (migrator) {
         return [key, migrator];
+      }
     }
 
     return ["", null];
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIProfileMigrator]),
   classDescription: "Profile Migrator",
   contractID: "@mozilla.org/toolkit/profile-migrator;1",
rename from suite/components/profile/SuiteProfileMigrator.manifest
rename to suite/components/migration/SuiteProfileMigrator.manifest
rename from suite/components/profile/content/migration.js
rename to suite/components/migration/content/migration.js
--- a/suite/components/profile/content/migration.js
+++ b/suite/components/migration/content/migration.js
@@ -1,89 +1,84 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-const nsISuiteProfileMigrator = Ci.nsISuiteProfileMigrator;
-const nsIProfileStartup       = Ci.nsIProfileStartup;
-const nsISupportsString       = Ci.nsISupportsString;
-const NS_PROFILE_MIGRATOR_CONTRACTID = "@mozilla.org/profile/migrator;1?app=suite&type=";
+const NS_PROFILE_MIGRATOR_CONTRACTID =
+  "@mozilla.org/profile/migrator;1?app=suite&type=";
 
 var MigrationWizard = {
   _source: "",                  // Source Profile Migrator ContractID suffix
-  _itemsFlags: nsISuiteProfileMigrator.ALL, // Selected Import Data Sources
+  _itemsFlags: Ci.nsISuiteProfileMigrator.ALL, // Selected Import Data Sources
   _selectedProfile: null,       // Selected Profile name to import from
   _wiz: null,                   // Shortcut to the wizard
   _migrator: null,              // The actual profile migrator.
   _autoMigrate: null,           // Whether or not we are actually migrating.
   _singleItem: false,           // Are we choosing just to import a single
                                 // item into the current profile?
   _newHomePage: null,           // Are we setting a new home page - what to?
 
   init: function() {
-    var os = Cc["@mozilla.org/observer-service;1"]
-               .getService(Ci.nsIObserverService);
-    os.addObserver(this, "Migration:Started");
-    os.addObserver(this, "Migration:ItemBeforeMigrate");
-    os.addObserver(this, "Migration:ItemAfterMigrate");
-    os.addObserver(this, "Migration:Ended");
-    os.addObserver(this, "Migration:Progress");
+    Services.obs.addObserver(this, "Migration:Started");
+    Services.obs.addObserver(this, "Migration:ItemBeforeMigrate");
+    Services.obs.addObserver(this, "Migration:ItemAfterMigrate");
+    Services.obs.addObserver(this, "Migration:Ended");
+    Services.obs.addObserver(this, "Migration:Progress");
 
     this._wiz = document.documentElement;
     this._wiz.canRewind = false;
 
     if ("arguments" in window) {
       if ("arguments" in window && window.arguments[0] == "bookmarks") {
         this._singleItem = true;
-        this._itemsFlags = nsISuiteProfileMigrator.BOOKMARKS;
+        this._itemsFlags = Ci.nsISuiteProfileMigrator.BOOKMARKS;
         document.getElementById("fromFile").hidden = false;
         document.getElementById("importBookmarks").hidden = false;
         document.getElementById("importAll").hidden = true;
       }
       else if (window.arguments.length > 1) {
         this._source = window.arguments[0];
-        this._migrator = window.arguments[1] instanceof nsISuiteProfileMigrator ?
-                         window.arguments[1] : null;
+        this._migrator =
+          window.arguments[1] instanceof Ci.nsISuiteProfileMigrator ?
+            window.arguments[1] : null;
         this._autoMigrate = window.arguments[2]
-                                  .QueryInterface(nsIProfileStartup);
+                                  .QueryInterface(Ci.nsIProfileStartup);
         // Show the "nothing" option in the automigrate case to provide an
         // easily identifiable way to avoid migration and create a new profile.
         document.getElementById("nothing").hidden = false;
       }
     }
 
     this.onImportSourcePageShow();
   },
 
   uninit: function() {
-    var os = Cc["@mozilla.org/observer-service;1"]
-               .getService(Ci.nsIObserverService);
-    os.removeObserver(this, "Migration:Started");
-    os.removeObserver(this, "Migration:ItemBeforeMigrate");
-    os.removeObserver(this, "Migration:ItemAfterMigrate");
-    os.removeObserver(this, "Migration:Ended");
-    os.removeObserver(this, "Migration:Progress", false);
+    Services.obs.removeObserver(this, "Migration:Started");
+    Services.obs.removeObserver(this, "Migration:ItemBeforeMigrate");
+    Services.obs.removeObserver(this, "Migration:ItemAfterMigrate");
+    Services.obs.removeObserver(this, "Migration:Ended");
+    Services.obs.removeObserver(this, "Migration:Progress");
   },
 
   // 1 - Import Source
   onImportSourcePageShow: function() {
     // Figure out what source apps are are available to import from:
     var group = document.getElementById("importSourceGroup");
     var firstSelectable = null;
     for (var i = 0; i < group.childNodes.length; ++i) {
       var suffix = group.childNodes[i].id;
       if (suffix != "nothing" && suffix != "fromFile") {
         var contractID = NS_PROFILE_MIGRATOR_CONTRACTID + suffix;
         var migrator = null;
         if (contractID in Cc) {
           migrator = Cc[contractID]
-                       .createInstance(nsISuiteProfileMigrator);
+                       .createInstance(Ci.nsISuiteProfileMigrator);
         } else {
           dump("*** invalid contractID =" + contractID + "\n");
           // This is an invalid contract id, therefore hide this element
           // and allow things to continue - that way we should be able to
           // copy with anything happening.
           group.childNodes[i].hidden = true;
           break;
         }
@@ -127,17 +122,17 @@ var MigrationWizard = {
       // called cancel - cancel may not get processed first.
       return false;
     }
 
     if (!this._migrator || newSource != this._source) {
       // Create the migrator for the selected source.
       var contractID = NS_PROFILE_MIGRATOR_CONTRACTID + newSource;
       this._migrator = Cc[contractID]
-                         .createInstance(nsISuiteProfileMigrator);
+                         .createInstance(Ci.nsISuiteProfileMigrator);
 
       this._selectedProfile = null;
     }
     this._source = newSource;
 
     // check for more than one source profile
     if (this._migrator.sourceHasMultipleProfiles)
       this._wiz.currentPage.next = "selectProfile";
@@ -147,17 +142,17 @@ var MigrationWizard = {
       else if (this._singleItem)
         this._wiz.currentPage.next = "migrating";
       else
         this._wiz.currentPage.next = "importItems";
 
       var sourceProfiles = this._migrator.sourceProfiles;
       if (sourceProfiles && sourceProfiles.length == 1) {
         this._selectedProfile = sourceProfiles
-            .queryElementAt(0, nsISupportsString).data;
+            .queryElementAt(0, Ci.nsISupportsString).data;
       }
       else
         this._selectedProfile = "";
     }
     return true;
   },
 
   // 2 - [Profile Selection]
@@ -165,17 +160,17 @@ var MigrationWizard = {
     var profiles = document.getElementById("profiles");
     while (profiles.hasChildNodes())
       profiles.lastChild.remove();
 
     var sourceProfiles = this._migrator.sourceProfiles;
     var count = sourceProfiles.length;
     for (var i = 0; i < count; ++i) {
       var item = document.createElement("radio");
-      item.id = sourceProfiles.queryElementAt(i, nsISupportsString).data;
+      item.id = sourceProfiles.queryElementAt(i, Ci.nsISupportsString).data;
       item.setAttribute("label", item.id);
       profiles.appendChild(item);
     }
 
     profiles.selectedItem = this._selectedProfile ?
       document.getElementById(this._selectedProfile) : profiles.firstChild;
   },
 
@@ -272,17 +267,17 @@ var MigrationWizard = {
     var source = null;
     if (this._source != "") {
       source = "sourceName" + this._source;
     }
 
     var availableItems = this._migrator.getMigrateData(this._selectedProfile,
                                                        this._autoMigrate);
 
-    if (source && (availableItems & nsISuiteProfileMigrator.HOMEPAGEDATA)) {
+    if (source && (availableItems & Ci.nsISuiteProfileMigrator.HOMEPAGEDATA)) {
       var appName = document.getElementById("bundle").getString(source);
       var oldHomePageLabel = bundle.getFormattedString("homePageImport",
                                                        [appName]);
       var oldHomePage = document.getElementById("oldHomePage");
       oldHomePage.setAttribute("label", oldHomePageLabel);
       oldHomePage.setAttribute("value", "source");
       oldHomePage.removeAttribute("hidden");
       oldHomePage.focus();
@@ -311,17 +306,17 @@ var MigrationWizard = {
 
     // When migrating a profile on startup, show all of the data that can be
     // received from this source, but exclude home pages if the user didn't
     // want to migrate it.
     if (this._autoMigrate) {
       this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile,
                                                        this._autoMigrate);
       if (!this._newHomePage)
-        this._itemsFlags &= ~nsISuiteProfileMigrator.HOMEPAGEDATA;
+        this._itemsFlags &= ~Ci.nsISuiteProfileMigrator.HOMEPAGEDATA;
     }
 
     this._listItems("migratingItems");
     setTimeout(this.onMigratingMigrate, 0, this);
   },
 
   onMigratingMigrate: function(aOuter) {
     aOuter._migrator.migrate(aOuter._itemsFlags,
@@ -331,17 +326,17 @@ var MigrationWizard = {
 
   _listItems: function(aID) {
     var items = document.getElementById(aID);
     while (items.hasChildNodes())
       items.lastChild.remove();
 
     var bundle = document.getElementById("bundle");
     var itemID;
-    for (var x = 1; x < nsISuiteProfileMigrator.ALL;
+    for (var x = 1; x < Ci.nsISuiteProfileMigrator.ALL;
          x = x << 1) {
       if (x & this._itemsFlags) {
         var label = document.createElement("label");
         label.id = x + "_migrated";
         try {
           label.setAttribute("value",
                              bundle.stringBundle
                                    .GetStringFromName(x + "_"+ this._source));
rename from suite/components/profile/content/migration.xul
rename to suite/components/migration/content/migration.xul
copy from suite/components/profile/jar.mn
copy to suite/components/migration/jar.mn
--- a/suite/components/profile/jar.mn
+++ b/suite/components/migration/jar.mn
@@ -1,11 +1,7 @@
 # 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/.
 
 comm.jar:
-% override chrome://mozapps/content/profile/profileSelection.xul chrome://communicator/content/profile/profileSelection.xul
   content/communicator/migration/migration.xul                     (content/migration.xul)
   content/communicator/migration/migration.js                      (content/migration.js)
-  content/communicator/profile/profileSelection.js                 (content/profileSelection.js)
-  content/communicator/profile/profileSelection.xul                (content/profileSelection.xul)
-
copy from suite/components/profile/moz.build
copy to suite/components/migration/moz.build
--- a/suite/components/profile/moz.build
+++ b/suite/components/migration/moz.build
@@ -1,30 +1,19 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-XPIDL_SOURCES += [
-    'nsISuiteProfileMigrator.idl',
-]
-
-XPIDL_MODULE = 'suitemigration'
-
-SOURCES += [
-    'nsNetscapeProfileMigratorBase.cpp',
-    'nsSuiteDirectoryProvider.cpp',
-    'nsSuiteProfileMigratorUtils.cpp',
-    'nsThunderbirdProfileMigrator.cpp',
+DIRS += [
+    'public',
+    'src',
 ]
 
 EXTRA_COMPONENTS += [
+    'SuiteProfileMigrator.js',
     'SuiteProfileMigrator.manifest',
 ]
 
-EXTRA_PP_COMPONENTS += [
-    'SuiteProfileMigrator.js',
-]
-
 FINAL_LIBRARY = 'suite'
 
 JAR_MANIFESTS += ['jar.mn']
copy from suite/components/profile/moz.build
copy to suite/components/migration/public/moz.build
--- a/suite/components/profile/moz.build
+++ b/suite/components/migration/public/moz.build
@@ -5,26 +5,11 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPIDL_SOURCES += [
     'nsISuiteProfileMigrator.idl',
 ]
 
 XPIDL_MODULE = 'suitemigration'
 
-SOURCES += [
-    'nsNetscapeProfileMigratorBase.cpp',
-    'nsSuiteDirectoryProvider.cpp',
-    'nsSuiteProfileMigratorUtils.cpp',
-    'nsThunderbirdProfileMigrator.cpp',
+EXPORTS += [
+    'nsSuiteMigrationCID.h',
 ]
-
-EXTRA_COMPONENTS += [
-    'SuiteProfileMigrator.manifest',
-]
-
-EXTRA_PP_COMPONENTS += [
-    'SuiteProfileMigrator.js',
-]
-
-FINAL_LIBRARY = 'suite'
-
-JAR_MANIFESTS += ['jar.mn']
rename from suite/components/profile/nsISuiteProfileMigrator.idl
rename to suite/components/migration/public/nsISuiteProfileMigrator.idl
--- a/suite/components/profile/nsISuiteProfileMigrator.idl
+++ b/suite/components/migration/public/nsISuiteProfileMigrator.idl
@@ -44,17 +44,16 @@ interface nsISuiteProfileMigrator : nsIS
    *
    * @param   aProfile the profile that we are looking for available data
    *          to import
    * @param   aStarting "true" if the profile is not currently being used.
    * @returns bit field containing profile items (see above)
    */
   unsigned short getMigrateData(in wstring aProfile, in boolean aDoingStartup);
 
-
   /**
    * A bit field containing profile items that this migrator may be able
    * to import for any source profile of its type.
    */
   readonly attribute unsigned short   supportedItems;
 
   /**
    * Whether or not there is any data that can be imported from this
new file mode 100644
--- /dev/null
+++ b/suite/components/migration/public/nsSuiteMigrationCID.h
@@ -0,0 +1,8 @@
+/* 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/. */
+
+#define NS_SUITEPROFILEMIGRATOR_CONTRACTID_PREFIX "@mozilla.org/profile/migrator;1?app=suite&type="
+
+#define NS_THUNDERBIRDPROFILEMIGRATOR_CID \
+{ 0x6ba91adb, 0xa4ed, 0x405f, { 0xbd, 0x6c, 0xe9, 0x04, 0xa9, 0x9d, 0x9a, 0xd8 } }
copy from suite/components/profile/moz.build
copy to suite/components/migration/src/moz.build
--- a/suite/components/profile/moz.build
+++ b/suite/components/migration/src/moz.build
@@ -1,30 +1,13 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-XPIDL_SOURCES += [
-    'nsISuiteProfileMigrator.idl',
-]
-
-XPIDL_MODULE = 'suitemigration'
-
 SOURCES += [
-    'nsNetscapeProfileMigratorBase.cpp',
-    'nsSuiteDirectoryProvider.cpp',
+    'nsSuiteProfileMigratorBase.cpp',
     'nsSuiteProfileMigratorUtils.cpp',
     'nsThunderbirdProfileMigrator.cpp',
 ]
 
-EXTRA_COMPONENTS += [
-    'SuiteProfileMigrator.manifest',
-]
-
-EXTRA_PP_COMPONENTS += [
-    'SuiteProfileMigrator.js',
-]
-
 FINAL_LIBRARY = 'suite'
-
-JAR_MANIFESTS += ['jar.mn']
rename from suite/components/profile/nsNetscapeProfileMigratorBase.cpp
rename to suite/components/migration/src/nsSuiteProfileMigratorBase.cpp
--- a/suite/components/profile/nsNetscapeProfileMigratorBase.cpp
+++ b/suite/components/migration/src/nsSuiteProfileMigratorBase.cpp
@@ -1,104 +1,98 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsSuiteProfileMigratorUtils.h"
 #include "nsCRT.h"
-#include "nsICookieManager.h"
 #include "nsIFile.h"
 #include "nsILineInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIURL.h"
-#include "nsNetscapeProfileMigratorBase.h"
+#include "nsSuiteProfileMigratorBase.h"
 #include "nsNetUtil.h"
 #include "nsIDirectoryEnumerator.h"
 #include "nsIFileProtocolHandler.h"
 #include "nsServiceManagerUtils.h"
 #include "prtime.h"
 #include "nsINIParser.h"
 #include "nsArrayUtils.h"
 
 #define MAIL_DIR_50_NAME             NS_LITERAL_STRING("Mail")
 #define IMAP_MAIL_DIR_50_NAME        NS_LITERAL_STRING("ImapMail")
 #define NEWS_DIR_50_NAME             NS_LITERAL_STRING("News")
 #define DIR_NAME_CHROME              NS_LITERAL_STRING("chrome")
 
-NS_IMPL_ISUPPORTS(nsNetscapeProfileMigratorBase, nsISuiteProfileMigrator,
-                   nsITimerCallback)
+NS_IMPL_ISUPPORTS(nsSuiteProfileMigratorBase, nsISuiteProfileMigrator,
+                  nsITimerCallback)
 
 using namespace mozilla;
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsITimerCallback
 
 NS_IMETHODIMP
-nsNetscapeProfileMigratorBase::Notify(nsITimer *timer)
-{
+nsSuiteProfileMigratorBase::Notify(nsITimer *timer) {
   CopyNextFolder();
   return NS_OK;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-// nsNetscapeProfileMigratorBase
+// nsSuiteProfileMigratorBase
 
-nsNetscapeProfileMigratorBase::nsNetscapeProfileMigratorBase()
-{
+nsSuiteProfileMigratorBase::nsSuiteProfileMigratorBase() {
   mFileCopyTransactionIndex = 0;
   mObserverService = do_GetService("@mozilla.org/observer-service;1");
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsISuiteProfileMigrator methods
 
 NS_IMETHODIMP
-nsNetscapeProfileMigratorBase::GetSourceExists(bool* aResult)
-{
+nsSuiteProfileMigratorBase::GetSourceExists(bool* aResult) {
   nsCOMPtr<nsIArray> profiles;
   GetSourceProfiles(getter_AddRefs(profiles));
 
   if (profiles) {
     uint32_t count;
     profiles->GetLength(&count);
     *aResult = count > 0;
   }
   else
     *aResult = false;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsNetscapeProfileMigratorBase::GetSourceHasMultipleProfiles(bool* aResult)
-{
+nsSuiteProfileMigratorBase::GetSourceHasMultipleProfiles(bool* aResult) {
   nsCOMPtr<nsIArray> profiles;
   GetSourceProfiles(getter_AddRefs(profiles));
 
   if (profiles) {
     uint32_t count;
     profiles->GetLength(&count);
     *aResult = count > 1;
   }
   else
     *aResult = false;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsNetscapeProfileMigratorBase::GetSourceProfiles(nsIArray** aResult)
-{
+nsSuiteProfileMigratorBase::GetSourceProfiles(nsIArray** aResult) {
   if (!mProfileNames && !mProfileLocations) {
     nsresult rv;
     mProfileNames = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     if (NS_FAILED(rv))
       return rv;
 
     mProfileLocations = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     if (NS_FAILED(rv))
@@ -107,73 +101,16 @@ nsNetscapeProfileMigratorBase::GetSource
     // Fills mProfileNames and mProfileLocations
     FillProfileDataFromRegistry();
   }
 
   NS_IF_ADDREF(*aResult = mProfileNames);
   return NS_OK;
 }
 
-bool
-nsNetscapeProfileMigratorBase::GetSourceHasHomePageURL()
-{
-  // Load the source pref file
-  nsCOMPtr<nsIPrefService> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID));
-  psvc->ResetPrefs();
-
-  nsCOMPtr<nsIFile> sourcePrefsFile;
-
-  mSourceProfile->Clone(getter_AddRefs(sourcePrefsFile));
-  sourcePrefsFile->AppendNative(NS_LITERAL_CSTRING(FILE_NAME_PREFS));
-
-  psvc->ReadUserPrefsFromFile(sourcePrefsFile);
-
-  nsCOMPtr<nsIPrefBranch> branch(do_QueryInterface(psvc));
-
-  bool hasUserValue;
-  nsresult rv = branch->PrefHasUserValue("browser.startup.homepage",
-                                         &hasUserValue);
-
-  return NS_SUCCEEDED(rv) && hasUserValue;
-}
-
-nsresult
-nsNetscapeProfileMigratorBase::CopyHomePageData(bool aReplace)
-{
-  // Load the source pref file
-  nsCOMPtr<nsIPrefService> psvc(do_GetService(NS_PREFSERVICE_CONTRACTID));
-  psvc->ResetPrefs();
-
-  nsCOMPtr<nsIFile> sourcePrefsFile;
-  mSourceProfile->Clone(getter_AddRefs(sourcePrefsFile));
-  sourcePrefsFile->AppendNative(nsDependentCString(FILE_NAME_PREFS));
-  psvc->ReadUserPrefsFromFile(sourcePrefsFile);
-
-  PBStructArray homepageBranch;
-  ReadBranch("browser.startup.homepage", psvc, homepageBranch);
-
-  // Now that we have all the pref data in memory, load the target pref file,
-  // and write it back out
-  psvc->ResetPrefs();
-
-  nsCOMPtr<nsIFile> targetPrefsFile;
-  mTargetProfile->Clone(getter_AddRefs(targetPrefsFile));
-  targetPrefsFile->AppendNative(nsDependentCString(FILE_NAME_PREFS));
-
-  // Don't use nullptr here as we're too early in the cycle for the prefs
-  // service to get its default file (because the NS_GetDirectoryService items
-  // aren't fully set up yet).
-  psvc->ReadUserPrefsFromFile(targetPrefsFile);
-
-  WriteBranch("browser.startup.homepage", psvc, homepageBranch);
-
-  psvc->SavePrefFile(targetPrefsFile);
-
-  return NS_OK;
-}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Pref Transform methods
 
 #define GETPREF(xform, method, value) \
   xform->prefHasValue = NS_SUCCEEDED(aBranch->method(xform->sourcePrefName, value)); \
   return NS_OK;
 
@@ -181,70 +118,63 @@ nsNetscapeProfileMigratorBase::CopyHomeP
   if (xform->prefHasValue) { \
     return aBranch->method(xform->targetPrefName ? \
                            xform->targetPrefName : \
                            xform->sourcePrefName, value); \
   } \
   return NS_OK;
 
 nsresult
-nsNetscapeProfileMigratorBase::GetString(PrefTransform* aTransform,
-                                         nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::GetString(PrefTransform* aTransform,
+                                      nsIPrefBranch* aBranch) {
   PrefTransform* xform = (PrefTransform*)aTransform;
   nsCString str;
   nsresult rv = aBranch->GetCharPref(xform->sourcePrefName, str);
   if (NS_SUCCEEDED(rv)) {
     xform->prefHasValue = true;
     xform->stringValue = moz_xstrdup(str.get());
   }
   return rv;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::SetString(PrefTransform* aTransform,
-                                         nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::SetString(PrefTransform* aTransform,
+                                      nsIPrefBranch* aBranch) {
   PrefTransform* xform = (PrefTransform*) aTransform;
   SETPREF(aTransform, SetCharPref,
           nsDependentCString(xform->stringValue));
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::GetBool(PrefTransform* aTransform,
-                                       nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::GetBool(PrefTransform* aTransform,
+                                    nsIPrefBranch* aBranch) {
   GETPREF(aTransform, GetBoolPref, &aTransform->boolValue)
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::SetBool(PrefTransform* aTransform,
-                                       nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::SetBool(PrefTransform* aTransform,
+                                    nsIPrefBranch* aBranch) {
   SETPREF(aTransform, SetBoolPref, aTransform->boolValue)
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::GetInt(PrefTransform* aTransform,
-                                      nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::GetInt(PrefTransform* aTransform,
+                                   nsIPrefBranch* aBranch) {
   GETPREF(aTransform, GetIntPref, &aTransform->intValue)
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::SetInt(PrefTransform* aTransform,
-                                      nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::SetInt(PrefTransform* aTransform,
+                                   nsIPrefBranch* aBranch) {
   SETPREF(aTransform, SetIntPref, aTransform->intValue)
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::SetFile(PrefTransform* aTransform,
-                                       nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::SetFile(PrefTransform* aTransform,
+                                    nsIPrefBranch* aBranch) {
   // In this case targetPrefName is just an additional preference
   // that needs to be modified and not what the sourcePrefName is
   // going to be saved to once it is modified.
   nsresult rv = NS_OK;
   if (aTransform->prefHasValue) {
     nsCOMPtr<nsIProtocolHandler> handler;
     nsCOMPtr<nsIIOService> ioService(do_GetIOService());
     if (!ioService)
@@ -283,46 +213,32 @@ nsNetscapeProfileMigratorBase::SetFile(P
       if (NS_SUCCEEDED(rv) && aTransform->targetPrefName)
         rv = aBranch->SetIntPref(aTransform->targetPrefName, 1);
     }
   }
   return rv;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::SetImage(PrefTransform* aTransform,
-                                        nsIPrefBranch* aBranch)
-{
+nsSuiteProfileMigratorBase::SetImage(PrefTransform* aTransform,
+                                     nsIPrefBranch* aBranch) {
   if (aTransform->prefHasValue)
     // This transforms network.image.imageBehavior into
     // permissions.default.image
     return aBranch->SetIntPref("permissions.default.image",
                         aTransform->intValue == 1 ? 3 :
                         aTransform->intValue == 2 ? 2 : 1);
   return NS_OK;
 }
 
-nsresult
-nsNetscapeProfileMigratorBase::SetCookie(PrefTransform* aTransform,
-                                         nsIPrefBranch* aBranch)
-{
-  if (aTransform->prefHasValue)
-    return aBranch->SetIntPref("network.cookie.cookieBehavior",
-                               aTransform->intValue == 3 ? 0 :
-                               aTransform->intValue);
-
-  return NS_OK;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 // General Utility Methods
 
 nsresult
-nsNetscapeProfileMigratorBase::GetSourceProfile(const char16_t* aProfile)
-{
+nsSuiteProfileMigratorBase::GetSourceProfile(const char16_t* aProfile) {
   uint32_t count;
   mProfileNames->GetLength(&count);
   for (uint32_t i = 0; i < count; ++i) {
     nsCOMPtr<nsISupportsString> str(do_QueryElementAt(mProfileNames, i));
     nsString profileName;
     str->GetData(profileName);
     if (profileName.Equals(aProfile))
     {
@@ -330,20 +246,19 @@ nsNetscapeProfileMigratorBase::GetSource
       break;
     }
   }
 
   return NS_OK;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::GetProfileDataFromProfilesIni(nsIFile* aDataDir,
-                                                             nsIMutableArray* aProfileNames,
-                                                             nsIMutableArray* aProfileLocations)
-{
+nsSuiteProfileMigratorBase::GetProfileDataFromProfilesIni(nsIFile* aDataDir,
+                                                          nsIMutableArray* aProfileNames,
+                                                          nsIMutableArray* aProfileLocations) {
   nsresult rv;
   nsCOMPtr<nsIFile> profileIni;
   rv = aDataDir->Clone(getter_AddRefs(profileIni));
   NS_ENSURE_SUCCESS(rv, rv);
 
   profileIni->Append(NS_LITERAL_STRING("profiles.ini"));
 
   // Does it exist?
@@ -407,19 +322,18 @@ nsNetscapeProfileMigratorBase::GetProfil
       profileNameString->SetData(NS_ConvertUTF8toUTF16(buffer));
       aProfileNames->AppendElement(profileNameString);
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::CopyFile(const char* aSourceFileName,
-                                        const char* aTargetFileName)
-{
+nsSuiteProfileMigratorBase::CopyFile(const char* aSourceFileName,
+                                     const char* aTargetFileName) {
   nsCOMPtr<nsIFile> sourceFile;
   mSourceProfile->Clone(getter_AddRefs(sourceFile));
 
   sourceFile->AppendNative(nsDependentCString(aSourceFileName));
   bool exists = false;
   sourceFile->Exists(&exists);
   if (!exists)
     return NS_OK;
@@ -434,19 +348,18 @@ nsNetscapeProfileMigratorBase::CopyFile(
 
   return sourceFile->CopyToNative(mTargetProfile,
                                   nsDependentCString(aTargetFileName));
 }
 
 // helper function, copies the contents of srcDir into destDir.
 // destDir will be created if it doesn't exist.
 nsresult
-nsNetscapeProfileMigratorBase::RecursiveCopy(nsIFile* srcDir,
-                                             nsIFile* destDir)
-{
+nsSuiteProfileMigratorBase::RecursiveCopy(nsIFile* srcDir,
+                                          nsIFile* destDir) {
   bool exists;
   nsresult rv = srcDir->Exists(&exists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!exists)
     // We do not want to fail if the source folder does not exist because then
     // parts of the migration process following this would not get executed
     return NS_OK;
@@ -504,20 +417,19 @@ nsNetscapeProfileMigratorBase::Recursive
       }
     }
   }
 
   return rv;
 }
 
 void
-nsNetscapeProfileMigratorBase::ReadBranch(const char * branchName,
-                                          nsIPrefService* aPrefService,
-                                          PBStructArray &aPrefs)
-{
+nsSuiteProfileMigratorBase::ReadBranch(const char * branchName,
+                                       nsIPrefService* aPrefService,
+                                       PBStructArray &aPrefs) {
   // Enumerate the branch
   nsCOMPtr<nsIPrefBranch> branch;
   aPrefService->GetBranch(branchName, getter_AddRefs(branch));
 
   nsTArray<nsCString> prefs;
 
   nsresult rv = branch->GetChildList("", prefs);
   if (NS_FAILED(rv))
@@ -548,30 +460,29 @@ nsNetscapeProfileMigratorBase::ReadBranc
     case nsIPrefBranch::PREF_BOOL:
       rv = branch->GetBoolPref(currPref, &prefBranch->boolValue);
       break;
     case nsIPrefBranch::PREF_INT:
       rv = branch->GetIntPref(currPref, &prefBranch->intValue);
       break;
     default:
       NS_WARNING("Invalid prefBranch Type in "
-                 "nsNetscapeProfileMigratorBase::ReadBranch\n");
+                 "nsSuiteProfileMigratorBase::ReadBranch\n");
       break;
     }
 
     if (NS_SUCCEEDED(rv))
       aPrefs.AppendElement(prefBranch);
   }
 }
 
 void
-nsNetscapeProfileMigratorBase::WriteBranch(const char * branchName,
-                                           nsIPrefService* aPrefService,
-                                           PBStructArray &aPrefs)
-{
+nsSuiteProfileMigratorBase::WriteBranch(const char * branchName,
+                                        nsIPrefService* aPrefService,
+                                        PBStructArray &aPrefs) {
   // Enumerate the branch
   nsCOMPtr<nsIPrefBranch> branch;
   aPrefService->GetBranch(branchName, getter_AddRefs(branch));
 
   uint32_t count = aPrefs.Length();
   for (uint32_t i = 0; i < count; ++i) {
     PrefBranchStruct* pref = aPrefs.ElementAt(i);
 
@@ -586,30 +497,32 @@ nsNetscapeProfileMigratorBase::WriteBran
     case nsIPrefBranch::PREF_BOOL:
       branch->SetBoolPref(pref->prefName, pref->boolValue);
       break;
     case nsIPrefBranch::PREF_INT:
       branch->SetIntPref(pref->prefName, pref->intValue);
       break;
     default:
       NS_WARNING("Invalid Pref Type in "
-                 "nsNetscapeProfileMigratorBase::WriteBranch\n");
+                 "nsSuiteProfileMigratorBase::WriteBranch\n");
       break;
     }
     free(pref->prefName);
     pref->prefName = nullptr;
     delete pref;
     pref = nullptr;
   }
   aPrefs.Clear();
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::GetFileValue(nsIPrefBranch* aPrefBranch, const char* aRelPrefName, const char* aPrefName, nsIFile** aReturnFile)
-{
+nsSuiteProfileMigratorBase::GetFileValue(nsIPrefBranch* aPrefBranch,
+                                         const char* aRelPrefName,
+                                         const char* aPrefName,
+                                         nsIFile** aReturnFile) {
   nsCString prefValue;
   nsCOMPtr<nsIFile> theFile;
   nsresult rv = aPrefBranch->GetCharPref(aRelPrefName, prefValue);
   if (NS_SUCCEEDED(rv)) {
     // The pref has the format: [ProfD]a/b/c
     if (!StringBeginsWith(prefValue, NS_LITERAL_CSTRING("[ProfD]")))
       return NS_ERROR_FILE_NOT_FOUND;
 
@@ -626,125 +539,21 @@ nsNetscapeProfileMigratorBase::GetFileVa
                                       getter_AddRefs(theFile));
   }
 
   theFile.forget(aReturnFile);
   return rv;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-// Generic Import Functions
-
-nsresult
-nsNetscapeProfileMigratorBase::CopyCookies(bool aReplace)
-{
-  if (aReplace) {
-    // can't start the cookieservice, so just push files around:
-    // 1) remove target cookies.sqlite file if it exists, to force import
-    // 2) copy source cookies.txt file, which will be imported on startup
-    nsCOMPtr<nsIFile> targetFile;
-    mTargetProfile->Clone(getter_AddRefs(targetFile));
-    targetFile->AppendNative(NS_LITERAL_CSTRING(FILE_NAME_COOKIES_SQLITE));
-    targetFile->Remove(false);
-
-    return CopyFile(FILE_NAME_COOKIES, FILE_NAME_COOKIES);
-  }
-
-  nsresult rv;
-  nsCOMPtr<nsICookieManager> cookieManager(do_GetService(NS_COOKIEMANAGER_CONTRACTID, &rv));
-  if (NS_FAILED(rv))
-    return rv;
-
-  nsCOMPtr<nsIFile> seamonkeyCookiesFile;
-  mSourceProfile->Clone(getter_AddRefs(seamonkeyCookiesFile));
-  seamonkeyCookiesFile->AppendNative(NS_LITERAL_CSTRING(FILE_NAME_COOKIES));
-
-  return cookieManager->ImportCookies(seamonkeyCookiesFile);
-}
-
-nsresult
-nsNetscapeProfileMigratorBase::CopyUserSheet(const char* aFileName)
-{
-  nsCOMPtr<nsIFile> sourceUserContent;
-  mSourceProfile->Clone(getter_AddRefs(sourceUserContent));
-  sourceUserContent->Append(DIR_NAME_CHROME);
-  sourceUserContent->AppendNative(nsDependentCString(aFileName));
-
-  bool exists = false;
-  sourceUserContent->Exists(&exists);
-  if (!exists)
-    return NS_OK;
-
-  nsCOMPtr<nsIFile> targetUserContent;
-  mTargetProfile->Clone(getter_AddRefs(targetUserContent));
-  targetUserContent->Append(DIR_NAME_CHROME);
-  nsCOMPtr<nsIFile> targetChromeDir;
-  targetUserContent->Clone(getter_AddRefs(targetChromeDir));
-  targetUserContent->AppendNative(nsDependentCString(aFileName));
-
-  targetUserContent->Exists(&exists);
-  if (exists)
-    targetUserContent->Remove(false);
-
-  return sourceUserContent->CopyToNative(targetChromeDir,
-                                         nsDependentCString(aFileName));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Browser Import Functions
-
-nsresult
-nsNetscapeProfileMigratorBase::CopyBookmarks(bool aReplace)
-{
-  if (aReplace)
-    return CopyFile(FILE_NAME_BOOKMARKS, FILE_NAME_BOOKMARKS);
-
-  return ImportNetscapeBookmarks(FILE_NAME_BOOKMARKS, "sourceNameSeamonkey");
-}
-
-nsresult
-nsNetscapeProfileMigratorBase::CopyOtherData(bool aReplace)
-{
-  if (!aReplace)
-    return NS_OK;
-
-  nsCOMPtr<nsIFile> sourceSearchDir;
-  mSourceProfile->Clone(getter_AddRefs(sourceSearchDir));
-  sourceSearchDir->AppendNative(nsDependentCString(DIR_NAME_SEARCH));
-
-  nsCOMPtr<nsIFile> targetSearchDir;
-  mTargetProfile->Clone(getter_AddRefs(targetSearchDir));
-  targetSearchDir->AppendNative(nsDependentCString(DIR_NAME_SEARCH));
-
-  nsresult rv = RecursiveCopy(sourceSearchDir, targetSearchDir);
-  if (NS_FAILED(rv))
-    return rv;
-
-  return CopyFile(FILE_NAME_DOWNLOADS, FILE_NAME_DOWNLOADS);
-}
-
-nsresult
-nsNetscapeProfileMigratorBase::ImportNetscapeBookmarks(const char* aBookmarksFileName,
-                                                       const char* aImportSourceNameKey)
-{
-  nsCOMPtr<nsIFile> bookmarksFile;
-  mSourceProfile->Clone(getter_AddRefs(bookmarksFile));
-  bookmarksFile->AppendNative(nsDependentCString(aBookmarksFileName));
-
-  return ImportBookmarksHTML(bookmarksFile,
-                             NS_ConvertUTF8toUTF16(aImportSourceNameKey).get());
-}
-
-///////////////////////////////////////////////////////////////////////////////
 // Mail Import Functions
 
 nsresult
-nsNetscapeProfileMigratorBase::CopyAddressBookDirectories(PBStructArray &aLdapServers,
-                                                          nsIPrefService* aPrefService)
-{
+nsSuiteProfileMigratorBase::CopyAddressBookDirectories(PBStructArray &aLdapServers,
+                                                       nsIPrefService* aPrefService) {
   // each server has a pref ending with .filename. The value of that pref
   // points to a profile which we need to migrate.
   nsAutoString index;
   index.AppendInt(nsISuiteProfileMigrator::ADDRESSBOOK_DATA);
   NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());
 
   uint32_t count = aLdapServers.Length();
   for (uint32_t i = 0; i < count; ++i) {
@@ -759,19 +568,18 @@ nsNetscapeProfileMigratorBase::CopyAddre
   }
 
   NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
 
   return NS_OK;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::CopySignatureFiles(PBStructArray &aIdentities,
-                                                  nsIPrefService* aPrefService)
-{
+nsSuiteProfileMigratorBase::CopySignatureFiles(PBStructArray &aIdentities,
+                                               nsIPrefService* aPrefService) {
   nsresult rv = NS_OK;
 
   uint32_t count = aIdentities.Length();
   for (uint32_t i = 0; i < count; ++i)
   {
     PrefBranchStruct* pref = aIdentities.ElementAt(i);
     nsDependentCString prefName(pref->prefName);
 
@@ -812,26 +620,25 @@ nsNetscapeProfileMigratorBase::CopySigna
         pref->stringValue = ToNewCString(descriptorString);
       }
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::CopyJunkTraining(bool aReplace)
+nsSuiteProfileMigratorBase::CopyJunkTraining(bool aReplace)
 {
   return aReplace ? CopyFile(FILE_NAME_JUNKTRAINING,
                              FILE_NAME_JUNKTRAINING) : NS_OK;
 }
 
 nsresult
-nsNetscapeProfileMigratorBase::CopyMailFolderPrefs(PBStructArray &aMailServers,
-                                                   nsIPrefService* aPrefService)
-{
+nsSuiteProfileMigratorBase::CopyMailFolderPrefs(PBStructArray &aMailServers,
+                                                nsIPrefService* aPrefService) {
   // Each server has a .directory pref which points to the location of the
   // mail data for that server. We need to do two things for that case...
   // (1) Fix up the directory path for the new profile
   // (2) copy the mail folder data from the source directory pref to the
   //     destination directory pref
   CopyFile(FILE_NAME_VIRTUALFOLDERS, FILE_NAME_VIRTUALFOLDERS);
 
   int32_t count = aMailServers.Length();
@@ -951,18 +758,17 @@ nsNetscapeProfileMigratorBase::CopyMailF
       aMailServers.RemoveElementAt(i);
     }
   }
 
   return NS_OK;
 }
 
 void
-nsNetscapeProfileMigratorBase::CopyMailFolders()
-{
+nsSuiteProfileMigratorBase::CopyMailFolders() {
   nsAutoString index;
   index.AppendInt(nsISuiteProfileMigrator::MAILDATA);
   NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());
 
   // Generate the max progress value now that we know all of the files we
   // need to copy
   uint32_t count = mFileCopyTransactions.Length();
   mMaxProgress = 0;
@@ -974,18 +780,17 @@ nsNetscapeProfileMigratorBase::CopyMailF
     fileTransaction.srcFile->GetFileSize(&fileSize);
     mMaxProgress += fileSize;
   }
 
   CopyNextFolder();
 }
 
 void
-nsNetscapeProfileMigratorBase::CopyNextFolder()
-{
+nsSuiteProfileMigratorBase::CopyNextFolder() {
   if (mFileCopyTransactionIndex < mFileCopyTransactions.Length()) {
     fileTransactionEntry fileTransaction =
       mFileCopyTransactions.ElementAt(mFileCopyTransactionIndex++);
 
     // copy the file
     fileTransaction.srcFile->CopyTo(fileTransaction.destFile,
                                     EmptyString());
 
@@ -1016,18 +821,17 @@ nsNetscapeProfileMigratorBase::CopyNextF
   }
   else
     EndCopyFolders();
 
   return;
 }
 
 void
-nsNetscapeProfileMigratorBase::EndCopyFolders()
-{
+nsSuiteProfileMigratorBase::EndCopyFolders() {
   mFileCopyTransactions.Clear();
   mFileCopyTransactionIndex = 0;
 
   // notify the UI that we are done with the migration process
   nsAutoString index;
   index.AppendInt(nsISuiteProfileMigrator::MAILDATA);
   NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
 
rename from suite/components/profile/nsNetscapeProfileMigratorBase.h
rename to suite/components/migration/src/nsSuiteProfileMigratorBase.h
--- a/suite/components/profile/nsNetscapeProfileMigratorBase.h
+++ b/suite/components/migration/src/nsSuiteProfileMigratorBase.h
@@ -1,59 +1,54 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef netscapeprofilemigratorbase___h___
-#define netscapeprofilemigratorbase___h___
+#ifndef nsSuiteProfileMigratorBase___h___
+#define nsSuiteProfileMigratorBase___h___
 
 #include "nsIFile.h"
 #include "nsIMutableArray.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 #include "nsIObserverService.h"
 #include "nsISuiteProfileMigrator.h"
+#include "nsSuiteMigrationCID.h"
 
 class nsIPrefBranch;
 class nsIPrefService;
 
 struct fileTransactionEntry {
   nsCOMPtr<nsIFile> srcFile;  // the src path including leaf name
   nsCOMPtr<nsIFile> destFile; // the destination path
   nsString newName; // only valid if the file should be renamed after
                     // getting copied
 };
 
-#define FILE_NAME_BOOKMARKS       "bookmarks.html"
-#define FILE_NAME_COOKIES         "cookies.txt"
-#define FILE_NAME_COOKIES_SQLITE  "cookies.sqlite"
 #define FILE_NAME_PREFS           "prefs.js"
 #define FILE_NAME_JUNKTRAINING    "training.dat"
 #define FILE_NAME_VIRTUALFOLDERS  "virtualFolders.dat"
-#define FILE_NAME_USERCONTENT     "userContent.css"
-#define DIR_NAME_SEARCH           "searchplugins"
-#define FILE_NAME_DOWNLOADS       "downloads.rdf"
 
-#define F(a) nsNetscapeProfileMigratorBase::a
+#define F(a) nsSuiteProfileMigratorBase::a
 
 #define MAKEPREFTRANSFORM(pref, newpref, getmethod, setmethod) \
   { pref, newpref, F(Get##getmethod), F(Set##setmethod), false, { -1 } }
 
 #define MAKESAMETYPEPREFTRANSFORM(pref, method) \
   { pref, 0, F(Get##method), F(Set##method), false, { -1 } }
 
-class nsNetscapeProfileMigratorBase : public nsISuiteProfileMigrator,
-                                      public nsITimerCallback
+class nsSuiteProfileMigratorBase : public nsISuiteProfileMigrator,
+                                   public nsITimerCallback
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSITIMERCALLBACK
 
-  nsNetscapeProfileMigratorBase();
+  nsSuiteProfileMigratorBase();
 
   struct PrefTransform;
   typedef nsresult(*prefConverter)(PrefTransform*, nsIPrefBranch*);
 
   struct PrefTransform {
     const char*   sourcePrefName;
     const char*   targetPrefName;
     prefConverter prefGetterFunc;
@@ -90,17 +85,17 @@ public:
   static nsresult SetBool(PrefTransform* aTransform, nsIPrefBranch* aBranch);
   static nsresult GetInt(PrefTransform* aTransform, nsIPrefBranch* aBranch);
   static nsresult SetInt(PrefTransform* aTransform, nsIPrefBranch* aBranch);
   static nsresult SetFile(PrefTransform* aTransform, nsIPrefBranch* aBranch);
   static nsresult SetImage(PrefTransform* aTransform, nsIPrefBranch* aBranch);
   static nsresult SetCookie(PrefTransform* aTransform, nsIPrefBranch* aBranch);
 
 protected:
-  virtual ~nsNetscapeProfileMigratorBase() {}
+  virtual ~nsSuiteProfileMigratorBase() {}
   // This function is designed to be overriden by derived classes so that
   // the required profile data for the specific application can be obtained.
   virtual nsresult FillProfileDataFromRegistry() = 0;
 
   // General Utility Methods
   nsresult GetSourceProfile(const char16_t* aProfile);
   nsresult GetProfileDataFromProfilesIni(nsIFile* aDataDir,
                                          nsIMutableArray* aProfileNames,
@@ -110,28 +105,16 @@ protected:
   nsresult CopyFile(const char* aSourceFileName,
                     const char* aTargetFileName);
   nsresult RecursiveCopy(nsIFile* srcDir, nsIFile* destDir);
   void ReadBranch(const char * branchName, nsIPrefService* aPrefService,
                   PBStructArray &aPrefs);
   void WriteBranch(const char * branchName, nsIPrefService* aPrefService,
                    PBStructArray &aPrefs);
 
-  // Generic Import Functions
-  nsresult CopyCookies(bool aReplace);
-  nsresult CopyUserSheet(const char* aFileName);
-
-  // Browser Import Functions
-  nsresult CopyBookmarks(bool aReplace);
-  nsresult CopyOtherData(bool aReplace);
-  nsresult ImportNetscapeBookmarks(const char* aBookmarksFileName,
-                                   const char* aImportSourceNameKey);
-  bool GetSourceHasHomePageURL();
-  nsresult CopyHomePageData(bool aReplace);
-
   // Mail Import Functions
   nsresult CopyAddressBookDirectories(PBStructArray &aLdapServers,
                                       nsIPrefService* aPrefService);
   nsresult CopySignatureFiles(PBStructArray &aIdentities,
                               nsIPrefService* aPrefService);
   nsresult CopyJunkTraining(bool aReplace);
   nsresult CopyMailFolderPrefs(PBStructArray &aMailServers,
                                nsIPrefService* aPrefService);
rename from suite/components/profile/nsSuiteProfileMigratorUtils.cpp
rename to suite/components/migration/src/nsSuiteProfileMigratorUtils.cpp
--- a/suite/components/profile/nsSuiteProfileMigratorUtils.cpp
+++ b/suite/components/migration/src/nsSuiteProfileMigratorUtils.cpp
@@ -19,81 +19,16 @@
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIStringBundle.h"
 #include "nsCRT.h"
 
 #define MIGRATION_BUNDLE "chrome://communicator/migration/locale/migration.properties"
 
 using namespace mozilla;
 
-void SetUnicharPref(const char* aPref, const nsAString& aValue,
-                    nsIPrefBranch* aPrefs)
-{
-  nsCOMPtr<nsISupportsString> supportsString =
-    do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
-  if (supportsString) {
-     supportsString->SetData(aValue);
-     aPrefs->SetComplexValue(aPref, NS_GET_IID(nsISupportsString),
-                             supportsString);
-  }
-}
-
-void SetProxyPref(const nsAString& aHostPort, const char* aPref,
-                  const char* aPortPref, nsIPrefBranch* aPrefs)
-{
-  nsCOMPtr<nsIURI> uri;
-  nsAutoCString host;
-  int32_t portValue;
-
-  // try parsing it as a URI first
-  if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), aHostPort)) &&
-      NS_SUCCEEDED(uri->GetHost(host)) &&
-      !host.IsEmpty() &&
-      NS_SUCCEEDED(uri->GetPort(&portValue))) {
-    SetUnicharPref(aPref, NS_ConvertUTF8toUTF16(host), aPrefs);
-    aPrefs->SetIntPref(aPortPref, portValue);
-  }
-  else {
-    nsAutoString hostPort(aHostPort);
-    int32_t portDelimOffset = hostPort.RFindChar(':');
-    if (portDelimOffset > 0) {
-      SetUnicharPref(aPref, Substring(hostPort, 0, portDelimOffset), aPrefs);
-      nsAutoString port(Substring(hostPort, portDelimOffset + 1));
-      nsresult error;
-      portValue = port.ToInteger(&error);
-      aPrefs->SetIntPref(aPortPref, portValue);
-    }
-    else
-      SetUnicharPref(aPref, hostPort, aPrefs);
-  }
-}
-
-void ParseOverrideServers(const nsAString& aServers, nsIPrefBranch* aBranch)
-{
-  // Windows (and Opera) formats its proxy override list in the form:
-  // server;server;server where server is a server name or ip address,
-  // or "<local>". Mozilla's format is server,server,server, and <local>
-  // must be translated to "localhost,127.0.0.1"
-  nsAutoString override(aServers);
-  int32_t left = 0, right = 0;
-  for (;;) {
-    right = override.FindChar(';', right);
-    const nsAString& host =
-      Substring(override, left,
-                (right < 0 ? override.Length() : right) - left);
-    if (host.EqualsLiteral("<local>"))
-      override.Replace(left, 7, NS_LITERAL_STRING("localhost,127.0.0.1"));
-    if (right < 0)
-      break;
-    left = right + 1;
-    override.Replace(right, 1, NS_LITERAL_STRING(","));
-  }
-  SetUnicharPref("network.proxy.no_proxies_on", override, aBranch);
-}
-
 void GetMigrateDataFromArray(MigrationData* aDataArray,
                              int32_t aDataArrayLength,
                              bool aReplace, nsIFile* aSourceProfile,
                              uint16_t* aResult)
 {
   nsCOMPtr<nsIFile> sourceFile;
   bool exists;
   MigrationData* cursor;
@@ -124,16 +59,8 @@ GetProfilePath(nsIProfileStartup* aStart
     nsCOMPtr<nsIProperties> dirSvc
       (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     if (dirSvc) {
       dirSvc->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile),
                   (void**)aProfileDir);
     }
   }
 }
-
-nsresult
-ImportBookmarksHTML(nsIFile* aBookmarksFile,
-                    const char16_t* aImportSourceNameKey)
-{
-  // XXX: need to make this work with places
-  return NS_OK;
-}
rename from suite/components/profile/nsSuiteProfileMigratorUtils.h
rename to suite/components/migration/src/nsSuiteProfileMigratorUtils.h
--- a/suite/components/profile/nsSuiteProfileMigratorUtils.h
+++ b/suite/components/migration/src/nsSuiteProfileMigratorUtils.h
@@ -19,36 +19,30 @@
   if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \
     nsAutoString index; \
     index.AppendInt(itemIndex); \
     NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get()); \
     rv = func(replace); \
     NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get()); \
   }
 
-#define NC_URI(property) \
-  NS_LITERAL_CSTRING("http://home.netscape.com/NC-rdf#"#property)
+#define MAKEPREFTRANSFORM(pref, newpref, getmethod, setmethod) \
+  { pref, newpref, F(Get##getmethod), F(Set##setmethod), false, { -1 } }
 
+#define MAKESAMETYPEPREFTRANSFORM(pref, method) \
+  { pref, 0, F(Get##method), F(Set##method), false, { -1 } }
 
 #include "nsString.h"
 #include "nscore.h"
 #include "nsCOMPtr.h"
 
 class nsIPrefBranch;
 class nsIProfileStartup;
 class nsIFile;
 
-void SetUnicharPref(const char* aPref, const nsAString& aValue,
-                    nsIPrefBranch* aPrefs);
-
-// Proxy utilities shared by the Opera and IE migrators
-void ParseOverrideServers(const nsAString& aServers, nsIPrefBranch* aBranch);
-void SetProxyPref(const nsAString& aHostPort, const char* aPref,
-                  const char* aPortPref, nsIPrefBranch* aPrefs);
-
 struct MigrationData {
   const char* fileName;
   uint32_t sourceFlag;
   bool replaceOnly;
 };
 
 class nsIFile;
 void GetMigrateDataFromArray(MigrationData* aDataArray,
@@ -58,15 +52,9 @@ void GetMigrateDataFromArray(MigrationDa
                              uint16_t* aResult);
 
 
 // get the base directory of the *target* profile
 // this is already cloned, modify it to your heart's content
 void GetProfilePath(nsIProfileStartup* aStartup,
                     nsIFile** aProfileDir);
 
-// In-place import from aBookmarksFile into a folder in the user's bookmarks
-// with the name "From (STR:aImportSourceNameKey)" (aImportSourceNameKey
-// is a key into migration.properties with the pretty name of the application.
-nsresult ImportBookmarksHTML(nsIFile* aBookmarksFile,
-                             const char16_t* aImportSourceNameKey);
-
 #endif
rename from suite/components/profile/nsThunderbirdProfileMigrator.cpp
rename to suite/components/migration/src/nsThunderbirdProfileMigrator.cpp
--- a/suite/components/profile/nsThunderbirdProfileMigrator.cpp
+++ b/suite/components/migration/src/nsThunderbirdProfileMigrator.cpp
@@ -30,17 +30,17 @@
 #define FILE_NAME_HISTORY         "history.dat"
 #define FILE_NAME_SIGNONS         "signons.sqlite"
 #define FILE_NAME_MIMETYPES       "mimeTypes.rdf"
 #define FILE_NAME_USER_PREFS      "user.js"
 #define FILE_NAME_PERSONALDICTIONARY "persdict.dat"
 #define FILE_NAME_MAILVIEWS       "mailViews.dat"
 
 NS_IMPL_ISUPPORTS(nsThunderbirdProfileMigrator, nsISuiteProfileMigrator,
-                   nsITimerCallback)
+                  nsITimerCallback)
 
 nsThunderbirdProfileMigrator::nsThunderbirdProfileMigrator()
 {
 }
 
 nsThunderbirdProfileMigrator::~nsThunderbirdProfileMigrator()
 {
 }
@@ -65,20 +65,18 @@ nsThunderbirdProfileMigrator::Migrate(ui
     GetSourceProfile(aProfile);
     if (!mSourceProfile)
       return NS_ERROR_FILE_NOT_FOUND;
   }
 
   NOTIFY_OBSERVERS(MIGRATION_STARTED, nullptr);
 
   COPY_DATA(CopyPreferences,  aReplace, nsISuiteProfileMigrator::SETTINGS);
-  COPY_DATA(CopyCookies,      aReplace, nsISuiteProfileMigrator::COOKIES);
   COPY_DATA(CopyHistory,      aReplace, nsISuiteProfileMigrator::HISTORY);
   COPY_DATA(CopyPasswords,    aReplace, nsISuiteProfileMigrator::PASSWORDS);
-  COPY_DATA(CopyOtherData,    aReplace, nsISuiteProfileMigrator::OTHERDATA);
 
   // fake notifications for things we've already imported as part of
   // CopyPreferences
   nsAutoString index;
   index.AppendInt(nsISuiteProfileMigrator::ACCOUNT_SETTINGS);
   NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());
   NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
 
@@ -87,20 +85,19 @@ nsThunderbirdProfileMigrator::Migrate(ui
   NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get());
   NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
 
   // copy junk mail training file
   COPY_DATA(CopyJunkTraining, aReplace, nsISuiteProfileMigrator::JUNKTRAINING);
 
   if (aReplace &&
       (aItems & nsISuiteProfileMigrator::SETTINGS ||
-       aItems & nsISuiteProfileMigrator::COOKIES ||
        aItems & nsISuiteProfileMigrator::PASSWORDS ||
        !aItems)) {
-    // Permissions (Images, Cookies, Popups)
+    // Permissions (Images)
     if (NS_SUCCEEDED(rv))
       rv = CopyFile(FILE_NAME_SITEPERM_NEW, FILE_NAME_SITEPERM_NEW);
     if (NS_SUCCEEDED(rv))
       rv = CopyFile(FILE_NAME_SITEPERM_OLD, FILE_NAME_SITEPERM_OLD);
   }
 
   // the last thing to do is to actually copy over any mail folders
   // we have marked for copying we want to do this last and it will be
@@ -132,50 +129,39 @@ nsThunderbirdProfileMigrator::GetMigrate
     nsISuiteProfileMigrator::ADDRESSBOOK_DATA;
 
   MigrationData data[] = { { FILE_NAME_PREFS,
                              nsISuiteProfileMigrator::SETTINGS,
                              true },
                            { FILE_NAME_USER_PREFS,
                              nsISuiteProfileMigrator::SETTINGS,
                              true },
-                           { FILE_NAME_COOKIES,
-                             nsISuiteProfileMigrator::COOKIES,
-                             false },
                            { FILE_NAME_HISTORY,
                              nsISuiteProfileMigrator::HISTORY,
                              true },
                            { FILE_NAME_SIGNONS,
                              nsISuiteProfileMigrator::PASSWORDS,
                              true },
-                           { FILE_NAME_DOWNLOADS,
-                             nsISuiteProfileMigrator::OTHERDATA,
-                             true },
-                           { FILE_NAME_MIMETYPES,
-                             nsISuiteProfileMigrator::OTHERDATA,
-                             true },
                            { FILE_NAME_JUNKTRAINING,
                              nsISuiteProfileMigrator::JUNKTRAINING,
                              true } };
 
   GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData),
                           aReplace, mSourceProfile, aResult);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsThunderbirdProfileMigrator::GetSupportedItems(uint16_t *aSupportedItems)
 {
   NS_ENSURE_ARG_POINTER(aSupportedItems);
 
   *aSupportedItems = nsISuiteProfileMigrator::SETTINGS |
-    nsISuiteProfileMigrator::COOKIES |
     nsISuiteProfileMigrator::HISTORY |
-    nsISuiteProfileMigrator::OTHERDATA |
     nsISuiteProfileMigrator::JUNKTRAINING |
     nsISuiteProfileMigrator::PASSWORDS |
     nsISuiteProfileMigrator::ACCOUNT_SETTINGS |
     nsISuiteProfileMigrator::MAILDATA |
     nsISuiteProfileMigrator::NEWSDATA |
     nsISuiteProfileMigrator::ADDRESSBOOK_DATA;
 
   return NS_OK;
@@ -404,24 +390,16 @@ nsThunderbirdProfileMigrator::PrefTransf
   MAKESAMETYPEPREFTRANSFORM("news.show_size_in_lines",                 Bool),
   MAKESAMETYPEPREFTRANSFORM("news.update_unread_on_expand",            Bool),
 
   // pdi is the new preference, but nii is the old one - so do nii first, and
   // then do pdi to account for both situations
   MAKEPREFTRANSFORM("network.image.imageBehavior", 0, Int,             Image),
   MAKESAMETYPEPREFTRANSFORM("permissions.default.image",               Int),
 
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.alwaysAcceptSessionCookies",Bool),
-  MAKEPREFTRANSFORM("network.cookie.cookieBehavior", 0, Int,           Cookie),
-
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.lifetime.behavior",        Int),
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.lifetime.days",            Int),
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.lifetime.enabled",         Bool),
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.lifetimePolicy",           Int),
-  MAKESAMETYPEPREFTRANSFORM("network.cookie.warnAboutCookies",         Bool),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.autoconfig_url",            String),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.ftp",                       String),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.ftp_port",                  Int),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.http",                      String),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.http_port",                 Int),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.no_proxies_on",             String),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.socks",                     String),
   MAKESAMETYPEPREFTRANSFORM("network.proxy.socks_port",                Int),
@@ -576,19 +554,16 @@ nsThunderbirdProfileMigrator::CopyPrefer
   // User MIME Type overrides
   if (NS_SUCCEEDED(rv))
     rv = CopyFile(FILE_NAME_MIMETYPES, FILE_NAME_MIMETYPES);
   if (NS_SUCCEEDED(rv))
     rv = CopyFile(FILE_NAME_PERSONALDICTIONARY, FILE_NAME_PERSONALDICTIONARY);
   if (NS_SUCCEEDED(rv))
     rv = CopyFile(FILE_NAME_MAILVIEWS, FILE_NAME_MAILVIEWS);
 
-  if (NS_SUCCEEDED(rv))
-    rv = CopyUserSheet(FILE_NAME_USERCONTENT);
-
   return rv;
 }
 
 nsresult
 nsThunderbirdProfileMigrator::CopyHistory(bool aReplace)
 {
   return aReplace ? CopyFile(FILE_NAME_HISTORY, FILE_NAME_HISTORY) : NS_OK;
 }
rename from suite/components/profile/nsThunderbirdProfileMigrator.h
rename to suite/components/migration/src/nsThunderbirdProfileMigrator.h
--- a/suite/components/profile/nsThunderbirdProfileMigrator.h
+++ b/suite/components/migration/src/nsThunderbirdProfileMigrator.h
@@ -4,28 +4,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ThunderbirdProfileMigrator_h__
 #define ThunderbirdProfileMigrator_h__
 
 #include "nsISuiteProfileMigrator.h"
 #include "nsIFile.h"
 #include "nsIObserverService.h"
-#include "nsNetscapeProfileMigratorBase.h"
+#include "nsSuiteProfileMigratorBase.h"
 #include "nsITimer.h"
 #include "mozilla/Attributes.h"
 
 class nsIFile;
 class nsIPrefBranch;
 class nsIPrefService;
 
-#define NS_THUNDERBIRDPROFILEMIGRATOR_CID \
-{ 0x6ba91adb, 0xa4ed, 0x405f, { 0xbd, 0x6c, 0xe9, 0x04, 0xa9, 0x9d, 0x9a, 0xd8 } }
-
-class nsThunderbirdProfileMigrator final : public nsNetscapeProfileMigratorBase
+class nsThunderbirdProfileMigrator final : public nsSuiteProfileMigratorBase
 {
 public:
   NS_DECL_ISUPPORTS
 
   nsThunderbirdProfileMigrator();
 
   // nsISuiteProfileMigrator methods
   NS_IMETHOD Migrate(uint16_t aItems, nsIProfileStartup *aStartup,
--- a/suite/components/moz.build
+++ b/suite/components/moz.build
@@ -7,16 +7,17 @@
 DIRS += [
     'autocomplete',
     'bindings',
     'console',
     'dataman',
     'downloads',
     'feeds',
     'helpviewer',
+    'migration',
     'permissions',
     'places',
     'pref',
     'profile',
     'search',
     'sessionstore',
     'shell',
     'sidebar',
--- a/suite/components/profile/content/profileSelection.js
+++ b/suite/components/profile/content/profileSelection.js
@@ -122,21 +122,21 @@ function AcceptDialog()
     gPromptService.alert(window, null, message);
     return false;
   }
 
   // Although switching profile works by performing a restart internally,
   // the user is quitting the old profile, so make it look like a quit.
   var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
                      .createInstance(Ci.nsISupportsPRBool);
-  Cc["@mozilla.org/observer-service;1"]
-    .getService(Ci.nsIObserverService)
-    .notifyObservers(cancelQuit, "quit-application-requested");
-  if (cancelQuit.data)
+  Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
+
+  if (cancelQuit.data) {
     return false;
+  }
 
   try {
     var env = Cc["@mozilla.org/process/environment;1"]
                 .getService(Ci.nsIEnvironment);
     env.set("XRE_PROFILE_NAME", selected.profile.name);
     env.set("XRE_PROFILE_PATH", selected.profile.rootDir.path);
     env.set("XRE_PROFILE_LOCAL_PATH", selected.profile.localDir.path);
     var app = Cc["@mozilla.org/toolkit/app-startup;1"]
--- a/suite/components/profile/jar.mn
+++ b/suite/components/profile/jar.mn
@@ -1,11 +1,8 @@
 # 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/.
 
 comm.jar:
 % override chrome://mozapps/content/profile/profileSelection.xul chrome://communicator/content/profile/profileSelection.xul
-  content/communicator/migration/migration.xul                     (content/migration.xul)
-  content/communicator/migration/migration.js                      (content/migration.js)
   content/communicator/profile/profileSelection.js                 (content/profileSelection.js)
   content/communicator/profile/profileSelection.xul                (content/profileSelection.xul)
-
--- a/suite/components/profile/moz.build
+++ b/suite/components/profile/moz.build
@@ -1,30 +1,13 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-XPIDL_SOURCES += [
-    'nsISuiteProfileMigrator.idl',
-]
-
-XPIDL_MODULE = 'suitemigration'
-
 SOURCES += [
-    'nsNetscapeProfileMigratorBase.cpp',
     'nsSuiteDirectoryProvider.cpp',
-    'nsSuiteProfileMigratorUtils.cpp',
-    'nsThunderbirdProfileMigrator.cpp',
-]
-
-EXTRA_COMPONENTS += [
-    'SuiteProfileMigrator.manifest',
-]
-
-EXTRA_PP_COMPONENTS += [
-    'SuiteProfileMigrator.js',
 ]
 
 FINAL_LIBRARY = 'suite'
 
 JAR_MANIFESTS += ['jar.mn']