mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1222179 - remove unnecessary observation topics in nsNSSComponent r=Cykesiopka
nsNSSComponent would (unnecessarily) observe "profile-change-net-teardown" and "profile-change-net-restore". Now it no longer does.
This commit is contained in:
parent
3196e88019
commit
76e9b80948
@ -228,7 +228,6 @@ nsNSSComponent::nsNSSComponent()
|
||||
NS_ASSERTION( (0 == mInstanceCount), "nsNSSComponent is a singleton, but instantiated multiple times!");
|
||||
++mInstanceCount;
|
||||
mShutdownObjectList = nsNSSShutDownList::construct();
|
||||
mIsNetworkDown = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1239,10 +1238,6 @@ nsNSSComponent::RandomUpdate(void* entropy, int32_t bufLen)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char* const PROFILE_CHANGE_NET_TEARDOWN_TOPIC
|
||||
= "profile-change-net-teardown";
|
||||
static const char* const PROFILE_CHANGE_NET_RESTORE_TOPIC
|
||||
= "profile-change-net-restore";
|
||||
static const char* const PROFILE_BEFORE_CHANGE_TOPIC = "profile-before-change";
|
||||
static const char* const PROFILE_DO_CHANGE_TOPIC = "profile-do-change";
|
||||
|
||||
@ -1252,7 +1247,7 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
{
|
||||
if (nsCRT::strcmp(aTopic, PROFILE_BEFORE_CHANGE_TOPIC) == 0) {
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving profile change topic\n"));
|
||||
DoProfileBeforeChange(aSubject);
|
||||
DoProfileBeforeChange();
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_DO_CHANGE_TOPIC) == 0) {
|
||||
if (someData && NS_LITERAL_STRING("startup").Equals(someData)) {
|
||||
@ -1263,9 +1258,7 @@ 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).
|
||||
DoProfileChangeNetTeardown();
|
||||
DoProfileBeforeChange(aSubject);
|
||||
DoProfileChangeNetRestore();
|
||||
DoProfileBeforeChange();
|
||||
}
|
||||
|
||||
bool needsInit = true;
|
||||
@ -1348,14 +1341,6 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
if (clearSessionCache)
|
||||
SSL_ClearSessionCache();
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_NET_TEARDOWN_TOPIC) == 0) {
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving network teardown topic\n"));
|
||||
DoProfileChangeNetTeardown();
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_NET_RESTORE_TOPIC) == 0) {
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving network restore topic\n"));
|
||||
DoProfileChangeNetRestore();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1442,25 +1427,13 @@ nsNSSComponent::RegisterObservers()
|
||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, 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);
|
||||
observerService->AddObserver(this, PROFILE_CHANGE_NET_RESTORE_TOPIC, false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsNSSComponent::DoProfileChangeNetTeardown()
|
||||
nsNSSComponent::DoProfileBeforeChange()
|
||||
{
|
||||
if (mCertVerificationThread)
|
||||
mCertVerificationThread->requestExit();
|
||||
mIsNetworkDown = true;
|
||||
}
|
||||
|
||||
void
|
||||
nsNSSComponent::DoProfileBeforeChange(nsISupports* aSubject)
|
||||
{
|
||||
NS_ASSERTION(mIsNetworkDown, "nsNSSComponent relies on profile manager to wait for synchronous shutdown of all network activity");
|
||||
|
||||
bool needsCleanup = true;
|
||||
|
||||
{
|
||||
@ -1479,15 +1452,6 @@ nsNSSComponent::DoProfileBeforeChange(nsISupports* aSubject)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNSSComponent::DoProfileChangeNetRestore()
|
||||
{
|
||||
// XXX this doesn't work well, since nothing expects null pointers
|
||||
deleteBackgroundThreads();
|
||||
createBackgroundThreads();
|
||||
mIsNetworkDown = false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSComponent::IsNSSInitialized(bool* initialized)
|
||||
{
|
||||
|
@ -160,11 +160,7 @@ private:
|
||||
nsresult ConfigureInternalPKCS11Token();
|
||||
nsresult RegisterObservers();
|
||||
|
||||
// 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 DoProfileChangeNetTeardown();
|
||||
void DoProfileBeforeChange(nsISupports* aSubject);
|
||||
void DoProfileChangeNetRestore();
|
||||
void DoProfileBeforeChange();
|
||||
|
||||
mozilla::Mutex mutex;
|
||||
|
||||
@ -176,7 +172,6 @@ private:
|
||||
#ifndef MOZ_NO_SMART_CARDS
|
||||
SmartCardThreadList* mThreadList;
|
||||
#endif
|
||||
bool mIsNetworkDown;
|
||||
|
||||
void deleteBackgroundThreads();
|
||||
void createBackgroundThreads();
|
||||
|
@ -69,7 +69,6 @@ function testFindTestModule(shouldSucceed) {
|
||||
|
||||
function simulateShutdown() {
|
||||
let psmComponent = Cc["@mozilla.org/psm;1"].getService(Ci.nsIObserver);
|
||||
psmComponent.observe(null, "profile-change-net-teardown", null);
|
||||
psmComponent.observe(null, "profile-before-change", null);
|
||||
psmComponent.observe(null, "xpcom-shutdown", null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user