Bug 1388611 - Update mProfileName after a profile reset to handle multiple consecutive resets. r=dolske
Follow-up to
bug 1122124 to ensure `SaveWordToEnvIfUnset("XRE_PROFILE_NAME", mProfileName);` saves the updated profile name after reset takes the old profiles name.
MozReview-Commit-ID: MTJAQUKktM
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4450,16 +4450,17 @@ XREMain::XRE_mainRun()
if (gDoProfileReset) {
nsresult backupCreated = ProfileResetCleanup(profileBeingReset);
if (NS_FAILED(backupCreated)) NS_WARNING("Could not cleanup the profile that was reset");
nsCOMPtr<nsIToolkitProfile> newProfile;
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) {
rv = mProfileSvc->SetDefaultProfile(newProfile);
if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
}
} else {
NS_WARNING("Could not find current profile to set as default / change name.");