From 1a1d8ddc8cbba1cb405ca62f2be7402e39bb5a68 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Thu, 19 Apr 2018 14:29:05 +0200 Subject: moebius#84: Fix: The profile - resetting https://github.com/MoonchildProductions/moebius/pull/184 --- browser/components/migration/FirefoxProfileMigrator.js | 2 +- browser/components/migration/MigrationUtils.jsm | 1 + toolkit/modules/ResetProfile.jsm | 5 +++++ toolkit/xre/nsAppRunner.cpp | 8 +++++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/browser/components/migration/FirefoxProfileMigrator.js b/browser/components/migration/FirefoxProfileMigrator.js index 60ffcf627..2714cdbcd 100644 --- a/browser/components/migration/FirefoxProfileMigrator.js +++ b/browser/components/migration/FirefoxProfileMigrator.js @@ -7,7 +7,7 @@ "use strict"; /* - * Migrates from a Firefox profile in a lossy manner in order to clean up a + * Migrates from a Basilisk profile in a lossy manner in order to clean up a * user's profile. Data is only migrated where the benefits outweigh the * potential problems caused by importing undesired/invalid configurations * from the source profile. diff --git a/browser/components/migration/MigrationUtils.jsm b/browser/components/migration/MigrationUtils.jsm index 104efe005..e133ec520 100644 --- a/browser/components/migration/MigrationUtils.jsm +++ b/browser/components/migration/MigrationUtils.jsm @@ -726,6 +726,7 @@ this.MigrationUtils = Object.freeze({ "Internet Explorer": "ie", "Microsoft Edge": "edge", "Safari": "safari", + "Basilisk": "firefox", "Firefox": "firefox", "Nightly": "firefox", "Google Chrome": "chrome", // Windows, Linux diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm index fe0d1cfe8..0b1faacd0 100644 --- a/toolkit/modules/ResetProfile.jsm +++ b/toolkit/modules/ResetProfile.jsm @@ -12,6 +12,11 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/AppConstants.jsm"); const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME; +// For Basilisk and Pale Moon +// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator. +const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk") + || (AppConstants.MOZ_APP_NAME == "palemoon")) + ? "firefox" : AppConstants.MOZ_APP_NAME); const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP; this.ResetProfile = { diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 9fb20e5e2..a7b2b5146 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -3743,7 +3743,12 @@ XREMain::XRE_mainRun() if (gDoProfileReset) { // Automatically migrate from the current application if we just // reset the profile. - aKey = MOZ_APP_NAME; + // For Basilisk and Pale Moon: + // Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator. + aKey = (((MOZ_APP_NAME == "basilisk") + || (MOZ_APP_NAME == "palemoon")) + ? "firefox" : MOZ_APP_NAME); + } pm->Migrate(&mDirProvider, aKey, gResetOldProfileName); } @@ -3757,6 +3762,7 @@ XREMain::XRE_mainRun() rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile)); if (NS_SUCCEEDED(rv)) { newProfile->SetName(gResetOldProfileName); + mProfileName.Assign(gResetOldProfileName); // Set the new profile as the default after we're done cleaning up the old profile, // iff that profile was already the default if (profileWasSelected) { -- cgit v1.2.3