Bug 1265368 - ensure we flush even if we're not marking the profile as default, r?MattN
MozReview-Commit-ID: EgGcbHHOCf2
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2231,21 +2231,18 @@ SetCurrentProfileAsSelected(nsIToolkitPr
bool foundMatchingProfile = false;
nsCOMPtr<nsISupports> supports;
rv = profiles->GetNext(getter_AddRefs(supports));
while (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIToolkitProfile> profile = do_QueryInterface(supports);
nsCOMPtr<nsIFile> profileRoot;
profile->GetRootDir(getter_AddRefs(profileRoot));
profileRoot->Equals(aCurrentProfileRoot, &foundMatchingProfile);
- if (foundMatchingProfile && profile) {
- rv = aProfileSvc->SetSelectedProfile(profile);
- if (NS_SUCCEEDED(rv))
- rv = aProfileSvc->Flush();
- return rv;
+ if (foundMatchingProfile) {
+ return aProfileSvc->SetSelectedProfile(profile);
}
rv = profiles->GetNext(getter_AddRefs(supports));
}
return rv;
}
static bool gDoMigration = false;
static bool gDoProfileReset = false;
@@ -4202,16 +4199,19 @@ XREMain::XRE_mainRun()
// 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) {
//XXXgijs this is actually "broken" - see bug 1270615
rv = SetCurrentProfileAsSelected(mProfileSvc, mProfD);
if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
}
+ // Need to write out the fact that the profile has been removed and potentially
+ // that the selected/default profile changed.
+ mProfileSvc->Flush();
}
}
mDirProvider.DoStartup();
OverrideDefaultLocaleIfNeeded();
#ifdef MOZ_CRASHREPORTER