Bug 807757 part PSM - Remove nsIProfileChangeStatus and related veto notifications from PSM r=bsmith

--HG--
extra : rebase_source : d31d974b8d7da64e6a524fbbea4d98bf0d9a505a
This commit is contained in:
Benjamin Smedberg 2012-12-13 12:20:00 -05:00
Родитель 716ccdf964
Коммит d651f34b62
3 изменённых файлов: 5 добавлений и 64 удалений

Просмотреть файл

@ -349,8 +349,6 @@ CrlImportFailureNetworkProblem=Download of the CRL failed due to Network problem
CrlImportFailureReasonUnknown=Error Importing CRL to local Database. Error Code:
CrlImportFailure2=Please ask your system administrator for assistance.
NSSInitProblemX=Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features.
ProfileSwitchSocketsStillActive=The operation cannot be completed because of an internal failure. A secure network communication has not been cleaned up correctly.
ProfileSwitchCryptoUIActive=This operation is impossible at the current time. Please complete the operation that requests your attention in one of the other open windows.
VerifyExpired=<Expired>
VerifyRevoked=<Revoked>
VerifyNotTrusted=<Not Trusted>

Просмотреть файл

@ -24,7 +24,6 @@
#include "nsDirectoryServiceDefs.h"
#include "nsIX509Cert.h"
#include "nsIX509CertDB.h"
#include "nsIProfileChangeStatus.h"
#include "nsNSSCertificate.h"
#include "nsNSSHelper.h"
#include "nsSmartCardMonitor.h"
@ -1830,7 +1829,7 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
return NS_OK;
}
nsresult
void
nsNSSComponent::ShutdownNSS()
{
// Can be called both during init and profile change,
@ -2154,9 +2153,7 @@ nsNSSComponent::RandomUpdate(void *entropy, int32_t bufLen)
#define PROFILE_CHANGE_NET_TEARDOWN_TOPIC "profile-change-net-teardown"
#define PROFILE_CHANGE_NET_RESTORE_TOPIC "profile-change-net-restore"
#define PROFILE_APPROVE_CHANGE_TOPIC "profile-approve-change"
#define PROFILE_CHANGE_TEARDOWN_TOPIC "profile-change-teardown"
#define PROFILE_CHANGE_TEARDOWN_VETO_TOPIC "profile-change-teardown-veto"
#define PROFILE_BEFORE_CHANGE_TOPIC "profile-before-change"
#define PROFILE_DO_CHANGE_TOPIC "profile-do-change"
@ -2164,16 +2161,10 @@ NS_IMETHODIMP
nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *someData)
{
if (nsCRT::strcmp(aTopic, PROFILE_APPROVE_CHANGE_TOPIC) == 0) {
DoProfileApproveChange(aSubject);
}
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0) {
if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0) {
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("in PSM code, receiving change-teardown\n"));
DoProfileChangeTeardown(aSubject);
}
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC) == 0) {
mShutdownObjectList->allowUI();
}
else if (nsCRT::strcmp(aTopic, PROFILE_BEFORE_CHANGE_TOPIC) == 0) {
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving profile change topic\n"));
DoProfileBeforeChange(aSubject);
@ -2187,7 +2178,6 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
// it again. We use the same cleanup functionality used when switching
// profiles. The order of function calls must correspond to the order
// of notifications sent by Profile Manager (nsProfile).
DoProfileApproveChange(aSubject);
DoProfileChangeNetTeardown();
DoProfileChangeTeardown(aSubject);
DoProfileBeforeChange(aSubject);
@ -2209,10 +2199,6 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
if (needsInit) {
if (NS_FAILED(InitializeNSS(false))) { // do not show a warning box on failure
PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to Initialize NSS after profile switch.\n"));
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
if (status) {
status->ChangeFailed();
}
}
}
@ -2414,9 +2400,7 @@ nsNSSComponent::RegisterObservers()
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
observerService->AddObserver(this, PROFILE_APPROVE_CHANGE_TOPIC, false);
observerService->AddObserver(this, PROFILE_CHANGE_TEARDOWN_TOPIC, false);
observerService->AddObserver(this, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC, false);
observerService->AddObserver(this, PROFILE_BEFORE_CHANGE_TOPIC, false);
observerService->AddObserver(this, PROFILE_DO_CHANGE_TOPIC, false);
observerService->AddObserver(this, PROFILE_CHANGE_NET_TEARDOWN_TOPIC, false);
@ -2439,9 +2423,7 @@ nsNSSComponent::DeregisterObservers()
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
observerService->RemoveObserver(this, PROFILE_APPROVE_CHANGE_TOPIC);
observerService->RemoveObserver(this, PROFILE_CHANGE_TEARDOWN_TOPIC);
observerService->RemoveObserver(this, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC);
observerService->RemoveObserver(this, PROFILE_BEFORE_CHANGE_TOPIC);
observerService->RemoveObserver(this, PROFILE_DO_CHANGE_TOPIC);
observerService->RemoveObserver(this, PROFILE_CHANGE_NET_TEARDOWN_TOPIC);
@ -2481,23 +2463,6 @@ nsNSSComponent::RememberCert(CERTCertificate *cert)
return NS_OK;
}
static const char PROFILE_SWITCH_CRYPTO_UI_ACTIVE[] =
"ProfileSwitchCryptoUIActive";
static const char PROFILE_SWITCH_SOCKETS_STILL_ACTIVE[] =
"ProfileSwitchSocketsStillActive";
void
nsNSSComponent::DoProfileApproveChange(nsISupports* aSubject)
{
if (mShutdownObjectList->isUIActive()) {
ShowAlertFromStringBundle(PROFILE_SWITCH_CRYPTO_UI_ACTIVE);
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
if (status) {
status->VetoChange();
}
}
}
void
nsNSSComponent::DoProfileChangeNetTeardown()
{
@ -2509,23 +2474,7 @@ nsNSSComponent::DoProfileChangeNetTeardown()
void
nsNSSComponent::DoProfileChangeTeardown(nsISupports* aSubject)
{
bool callVeto = false;
if (!mShutdownObjectList->ifPossibleDisallowUI()) {
callVeto = true;
ShowAlertFromStringBundle(PROFILE_SWITCH_CRYPTO_UI_ACTIVE);
}
else if (mShutdownObjectList->areSSLSocketsActive()) {
callVeto = true;
ShowAlertFromStringBundle(PROFILE_SWITCH_SOCKETS_STILL_ACTIVE);
}
if (callVeto) {
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
if (status) {
status->VetoChange();
}
}
mShutdownObjectList->ifPossibleDisallowUI();
}
void
@ -2549,12 +2498,7 @@ nsNSSComponent::DoProfileBeforeChange(nsISupports* aSubject)
StopCRLUpdateTimer();
if (needsCleanup) {
if (NS_FAILED(ShutdownNSS())) {
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
if (status) {
status->ChangeFailed();
}
}
ShutdownNSS();
}
mShutdownObjectList->allowUI();
}

Просмотреть файл

@ -270,7 +270,7 @@ public:
private:
nsresult InitializeNSS(bool showWarningBox);
nsresult ShutdownNSS();
void ShutdownNSS();
#ifdef XP_MACOSX
void TryCFM2MachOMigration(nsIFile *cfmPath, nsIFile *machoPath);
@ -294,7 +294,6 @@ private:
// Methods that we use to handle the profile change notifications (and to
// synthesize a full profile change when we're just doing a profile startup):
void DoProfileApproveChange(nsISupports* aSubject);
void DoProfileChangeNetTeardown();
void DoProfileChangeTeardown(nsISupports* aSubject);
void DoProfileBeforeChange(nsISupports* aSubject);