b=175320 Support clean profile & NSS shutdown at any time + Mozilla needs to clean up on exit to allow for PSM failure detection
r=ccarlen sr=darin
This commit is contained in:
Родитель
d723770d5c
Коммит
629a2359bc
|
@ -247,6 +247,8 @@ nsProfile::nsProfile()
|
|||
|
||||
mIsUILocaleSpecified = PR_FALSE;
|
||||
mIsContentLocaleSpecified = PR_FALSE;
|
||||
|
||||
mShutdownProfileToreDownNetwork = PR_FALSE;
|
||||
}
|
||||
|
||||
nsProfile::~nsProfile()
|
||||
|
@ -1171,6 +1173,7 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
|
|||
|
||||
// Phase 2a: Send the network teardown notification
|
||||
observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
|
||||
mShutdownProfileToreDownNetwork = PR_TRUE;
|
||||
|
||||
// Phase 2b: Send the "teardown" notification
|
||||
observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
|
||||
|
@ -1192,12 +1195,7 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
mCurrentProfileAvailable = PR_TRUE;
|
||||
|
||||
if (isSwitch)
|
||||
{
|
||||
// Bring network back online
|
||||
observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
|
||||
}
|
||||
else
|
||||
if (!isSwitch)
|
||||
{
|
||||
// Ensure that the prefs service exists so it can respond to
|
||||
// the notifications we're about to send around. It needs to.
|
||||
|
@ -1205,6 +1203,13 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get prefs service");
|
||||
}
|
||||
|
||||
if (mShutdownProfileToreDownNetwork)
|
||||
{
|
||||
// Bring network back online
|
||||
observerService->NotifyObservers(subject, "profile-change-net-restore", context.get());
|
||||
mShutdownProfileToreDownNetwork = PR_FALSE;
|
||||
}
|
||||
+
|
||||
// Phase 4: Notify observers that the profile has changed - Here they respond to new profile
|
||||
observerService->NotifyObservers(subject, "profile-do-change", context.get());
|
||||
|
||||
|
@ -1259,7 +1264,11 @@ NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType)
|
|||
if (mProfileChangeVetoed)
|
||||
return NS_OK;
|
||||
|
||||
// Phase 2: Send the "teardown" notification
|
||||
// Phase 2a: Send the network teardown notification
|
||||
observerService->NotifyObservers(subject, "profile-change-net-teardown", context.get());
|
||||
mShutdownProfileToreDownNetwork = PR_TRUE;
|
||||
|
||||
// Phase 2b: Send the "teardown" notification
|
||||
observerService->NotifyObservers(subject, "profile-change-teardown", context.get());
|
||||
|
||||
// Phase 3: Notify observers of a profile change
|
||||
|
|
|
@ -102,6 +102,8 @@ private:
|
|||
PRBool mIsContentLocaleSpecified;
|
||||
nsCString mContentLocaleName;
|
||||
|
||||
PRBool mShutdownProfileToreDownNetwork;
|
||||
|
||||
public:
|
||||
nsProfile();
|
||||
virtual ~nsProfile();
|
||||
|
|
|
@ -875,8 +875,7 @@ static nsresult DoOnShutdown()
|
|||
nsCOMPtr<nsIProfile> profileMgr(do_GetService(NS_PROFILE_CONTRACTID, &rv));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get profile manager, so unable to update last modified time");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// 0 is undefined, we use this secret value so that we don't notify
|
||||
profileMgr->ShutDownCurrentProfile(0);
|
||||
profileMgr->ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче