diff --git a/browser/components/migration/content/migration.js b/browser/components/migration/content/migration.js index 97d4051ba09d..fa054d22bdd8 100644 --- a/browser/components/migration/content/migration.js +++ b/browser/components/migration/content/migration.js @@ -22,8 +22,7 @@ var MigrationWizard = { if ("arguments" in window) { this._source = window.arguments[0]; - this._migrator = window.arguments[1].QueryInterface(kIMig); - this._autoMigrate = window.arguments[2].QueryInterface(kIPStartup); + this._autoMigrate = window.arguments[1].QueryInterface(kIPStartup); // Show the "nothing" option in the automigrate case to provide an // easily identifiable way to avoid migration and create a new profile. @@ -56,8 +55,10 @@ var MigrationWizard = { if (suffix != "nothing") { var contractID = kProfileMigratorContractIDPrefix + suffix; var migrator = Components.classes[contractID].createInstance(kIMig); - if (!migrator.sourceExists) + if (!migrator.sourceExists) { group.childNodes[i].hidden = true; + if (this._source == suffix) this._source = null; + } } } diff --git a/browser/components/migration/src/nsProfileMigrator.cpp b/browser/components/migration/src/nsProfileMigrator.cpp index cce12d52edc0..2a3b8160031d 100644 --- a/browser/components/migration/src/nsProfileMigrator.cpp +++ b/browser/components/migration/src/nsProfileMigrator.cpp @@ -84,23 +84,7 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup) nsresult rv; nsCAutoString key; - nsCOMPtr bpm; - - rv = GetDefaultBrowserMigratorKey(key, bpm); - if (NS_FAILED(rv)) return rv; - - if (!bpm) { - nsCAutoString contractID = - NS_LITERAL_CSTRING(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX) + key; - - bpm = do_CreateInstance(contractID.get()); - if (!bpm) return NS_ERROR_FAILURE; - } - - PRBool sourceExists; - rv = bpm->GetSourceExists(&sourceExists); - NS_ENSURE_SUCCESS(rv, rv); - if (!sourceExists) return NS_ERROR_FAILURE; + GetDefaultBrowserMigratorKey(key); nsCOMPtr cstr (do_CreateInstance("@mozilla.org/supports-cstring;1")); @@ -115,7 +99,6 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup) if (!ww || !params) return NS_ERROR_FAILURE; params->AppendElement(cstr); - params->AppendElement(bpm); params->AppendElement(aStartup); nsCOMPtr migrateWizard; @@ -156,9 +139,8 @@ typedef struct { #define INTERNAL_NAME_OPERA "Opera" #endif -nsresult -nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey, - nsCOMPtr& bpm) +void +nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey) { #if XP_WIN HKEY hkey; @@ -223,26 +205,26 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey, if (!nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_IEXPLORE)) { aKey = "ie"; - return NS_OK; + return; } if (!nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_SEAMONKEY)) { aKey = "seamonkey"; - return NS_OK; + return; } if (!nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_DOGBERT)) { aKey = "dogbert"; - return NS_OK; + return; } if (!nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_OPERA)) { aKey = "opera"; - return NS_OK; + return; } // Migrate data from any existing Application Data\Phoenix\* installations. if (!nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_FIREBIRD) || !nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_FIREFOX) || !nsCRT::strcasecmp((char*)internalName, INTERNAL_NAME_PHOENIX)) { aKey = "phoenix"; - return NS_OK; + return; } } } @@ -253,12 +235,13 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey, // XXXben - until we figure out what to do here with default browsers on MacOS and // GNOME, simply copy data from a previous Seamonkey install. PRBool exists = PR_FALSE; - bpm = do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix"); + nsCOMPtr bpm = + do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "phoenix"); if (bpm) bpm->GetSourceExists(&exists); if (exists) { aKey = "phoenix"; - return NS_OK; + return; } bpm = do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey"); @@ -266,11 +249,8 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey, bpm->GetSourceExists(&exists); if (exists) { aKey = "seamonkey"; - return NS_OK; } #endif - - return NS_ERROR_FAILURE; } PRBool diff --git a/browser/components/migration/src/nsProfileMigrator.h b/browser/components/migration/src/nsProfileMigrator.h index 486c1d34af92..028f577642b9 100644 --- a/browser/components/migration/src/nsProfileMigrator.h +++ b/browser/components/migration/src/nsProfileMigrator.h @@ -56,8 +56,7 @@ public: protected: ~nsProfileMigrator() { }; - nsresult GetDefaultBrowserMigratorKey(nsACString& key, - nsCOMPtr& bpm); + void GetDefaultBrowserMigratorKey(nsACString& key); /** * Import profiles from ~/.firefox/ or ~/.phoenix/