Bug 76234 - XPCOM cleanups in PSM2. r=javi, sr=ben.

This commit is contained in:
bryner%uiuc.edu 2001-05-08 04:09:28 +00:00
parent e7a6b56631
commit e603ac5aeb

View File

@ -63,7 +63,6 @@ extern "C" {
PRLogModuleInfo* gPIPNSSLog = nsnull; PRLogModuleInfo* gPIPNSSLog = nsnull;
#endif #endif
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
PRBool nsNSSComponent::mNSSInitialized = PR_FALSE; PRBool nsNSSComponent::mNSSInitialized = PR_FALSE;
#ifdef XP_MAC #ifdef XP_MAC
@ -98,7 +97,6 @@ extern char * pk11PasswordPrompt(PK11SlotInfo *slot, PRBool retry, void *arg);
nsNSSComponent::nsNSSComponent() nsNSSComponent::nsNSSComponent()
{ {
NS_INIT_ISUPPORTS(); NS_INIT_ISUPPORTS();
mCertContentListener = nsnull;
} }
nsNSSComponent::~nsNSSComponent() nsNSSComponent::~nsNSSComponent()
@ -106,12 +104,10 @@ nsNSSComponent::~nsNSSComponent()
if (mCertContentListener) { if (mCertContentListener) {
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
NS_WITH_SERVICE(nsIURILoader, dispatcher, NS_URI_LOADER_CONTRACTID, &rv); nsCOMPtr<nsIURILoader> dispatcher(do_GetService(NS_URI_LOADER_CONTRACTID));
if (NS_SUCCEEDED(rv)) { if (dispatcher) {
rv = dispatcher->UnRegisterContentListener(mCertContentListener); rv = dispatcher->UnRegisterContentListener(mCertContentListener);
} }
mCertContentListener = nsnull;
} }
if (mPref) if (mPref)
mPref->UnregisterCallback("security.", nsNSSComponent::PrefChangedCallback, mPref->UnregisterCallback("security.", nsNSSComponent::PrefChangedCallback,
@ -192,12 +188,10 @@ nsNSSComponent::InstallLoadableRoots()
if (NS_FAILED(rv)) return; if (NS_FAILED(rv)) return;
nsCOMPtr<nsILocalFile> mozFile; nsCOMPtr<nsILocalFile> mozFile;
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); if (!directoryService)
if (NS_FAILED(rv)) { return;
return ;
}
directoryService->Get( NS_XPCOM_CURRENT_PROCESS_DIR, directoryService->Get( NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile), NS_GET_IID(nsIFile),
getter_AddRefs(mozFile)); getter_AddRefs(mozFile));
@ -333,9 +327,9 @@ nsresult
nsNSSComponent::RegisterCertContentListener() nsNSSComponent::RegisterCertContentListener()
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (mCertContentListener == nsnull) { if (!mCertContentListener) {
NS_WITH_SERVICE(nsIURILoader, dispatcher, NS_URI_LOADER_CONTRACTID, &rv); nsCOMPtr<nsIURILoader> dispatcher(do_GetService(NS_URI_LOADER_CONTRACTID));
if (NS_SUCCEEDED(rv)) { if (dispatcher) {
mCertContentListener = do_CreateInstance(NS_CERTCONTENTLISTEN_CONTRACTID); mCertContentListener = do_CreateInstance(NS_CERTCONTENTLISTEN_CONTRACTID);
rv = dispatcher->RegisterContentListener(mCertContentListener); rv = dispatcher->RegisterContentListener(mCertContentListener);
} }
@ -450,12 +444,12 @@ NS_IMPL_THREADSAFE_ISUPPORTS6(nsNSSComponent,
NS_IMETHODIMP NS_IMETHODIMP
nsNSSComponent::DisplaySecurityAdvisor() nsNSSComponent::DisplaySecurityAdvisor()
{ {
return NS_ERROR_FAILURE; // not implemented return NS_ERROR_NOT_IMPLEMENTED; // not implemented
} }
//--------------------------------------------- //---------------------------------------------
// Functions Implenenting NSISignatureVerifier // Functions Implementing nsISignatureVerifier
//--------------------------------------------- //---------------------------------------------
NS_IMETHODIMP NS_IMETHODIMP
nsNSSComponent::HashBegin(PRUint32 alg, PRUint32* id) nsNSSComponent::HashBegin(PRUint32 alg, PRUint32* id)
@ -561,8 +555,7 @@ nsNSSComponent::RegisterProfileChangeObserver()
{ {
nsresult rv; nsresult rv;
NS_WITH_SERVICE(nsIObserverService, observerService, nsCOMPtr<nsIObserverService> observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID));
NS_OBSERVERSERVICE_CONTRACTID, &rv);
NS_ASSERTION(observerService, "could not get observer service"); NS_ASSERTION(observerService, "could not get observer service");
if (observerService) { if (observerService) {
observerService->AddObserver(this, PROFILE_BEFORE_CHANGE_TOPIC); observerService->AddObserver(this, PROFILE_BEFORE_CHANGE_TOPIC);