moebius#84: Fix: The profile - resetting

https://github.com/MoonchildProductions/moebius/pull/184
This commit is contained in:
janekptacijarabaci 2018-04-19 14:29:05 +02:00 • committed by Roy Tam
commit 8523f693be
4 changed files with 14 additions and 2 deletions

View file

@ -7,7 +7,7 @@
"use strict"; "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 * user's profile. Data is only migrated where the benefits outweigh the
* potential problems caused by importing undesired/invalid configurations * potential problems caused by importing undesired/invalid configurations
* from the source profile. * from the source profile.

View file

@ -726,6 +726,7 @@ this.MigrationUtils = Object.freeze({
"Internet Explorer": "ie", "Internet Explorer": "ie",
"Microsoft Edge": "edge", "Microsoft Edge": "edge",
"Safari": "safari", "Safari": "safari",
"Basilisk": "firefox",
"Firefox": "firefox", "Firefox": "firefox",
"Nightly": "firefox", "Nightly": "firefox",
"Google Chrome": "chrome", // Windows, Linux "Google Chrome": "chrome", // Windows, Linux

View file

@ -12,6 +12,11 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/AppConstants.jsm");
const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME; 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; const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
this.ResetProfile = { this.ResetProfile = {

View file

@ -3747,7 +3747,12 @@ XREMain::XRE_mainRun()
if (gDoProfileReset) { if (gDoProfileReset) {
// Automatically migrate from the current application if we just // Automatically migrate from the current application if we just
// reset the profile. // 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); pm->Migrate(&mDirProvider, aKey, gResetOldProfileName);
} }
@ -3761,6 +3766,7 @@ XREMain::XRE_mainRun()
rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile)); rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
newProfile->SetName(gResetOldProfileName); newProfile->SetName(gResetOldProfileName);
mProfileName.Assign(gResetOldProfileName);
// Set the new profile as the default after we're done cleaning up the old profile, // Set the new profile as the default after we're done cleaning up the old profile,
// iff that profile was already the default // iff that profile was already the default
if (profileWasSelected) { if (profileWasSelected) {