Bug 1388611 - Update mProfileName after a profile reset to handle multiple consecutive resets. r=dolske draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 30 Aug 2017 23:47:17 -0700
changeset 656418 6d438aa8d4d810449ee2b4fc415afc3e468bbd2e
parent 656284 d9b405d82cffb07343a5f2fd941e029298c7f6c4
child 656427 a4918136167889674921e552bdde92ced3c7d6bf
push id77217
push usermozilla@noorenberghe.ca
push dateThu, 31 Aug 2017 06:48:02 +0000
reviewersdolske
bugs1388611, 1122124
milestone57.0a1
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
toolkit/xre/nsAppRunner.cpp
--- 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.");