diff --git a/mozilla/security/manager/ssl/src/nsCertVerificationThread.cpp b/mozilla/security/manager/ssl/src/nsCertVerificationThread.cpp index 4df572ff5a2..c9d8c34ca98 100644 --- a/mozilla/security/manager/ssl/src/nsCertVerificationThread.cpp +++ b/mozilla/security/manager/ssl/src/nsCertVerificationThread.cpp @@ -100,8 +100,6 @@ nsCertVerificationThread::nsCertVerificationThread() " to create another instance!"); verification_thread_singleton = this; - - NS_ASSERTION(mThreadHandle, "Could not create nsThreadRunner thread\n"); } nsCertVerificationThread::~nsCertVerificationThread() diff --git a/mozilla/security/manager/ssl/src/nsNSSComponent.cpp b/mozilla/security/manager/ssl/src/nsNSSComponent.cpp index 623e49f5ce0..5d1850dc7a0 100644 --- a/mozilla/security/manager/ssl/src/nsNSSComponent.cpp +++ b/mozilla/security/manager/ssl/src/nsNSSComponent.cpp @@ -301,7 +301,11 @@ nsNSSComponent::nsNSSComponent() mShutdownObjectList = nsNSSShutDownList::construct(); mIsNetworkDown = PR_FALSE; mSSLThread = new nsSSLThread(); + if (mSSLThread) + mSSLThread->startThread(); mCertVerificationThread = new nsCertVerificationThread(); + if (mCertVerificationThread) + mCertVerificationThread->startThread(); } nsNSSComponent::~nsNSSComponent() @@ -1953,8 +1957,12 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic, PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving network restore topic\n")); delete mSSLThread; mSSLThread = new nsSSLThread(); + if (mSSLThread) + mSSLThread->startThread(); delete mCertVerificationThread; mCertVerificationThread = new nsCertVerificationThread(); + if (mCertVerificationThread) + mCertVerificationThread->startThread(); mIsNetworkDown = PR_FALSE; } diff --git a/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.cpp b/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.cpp index 59a282a5fed..c0fd971f393 100644 --- a/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.cpp +++ b/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.cpp @@ -52,14 +52,22 @@ nsPSMBackgroundThread::nsPSMBackgroundThread() { mMutex = PR_NewLock(); mCond = PR_NewCondVar(mMutex); +} - if (mMutex && mCond) - { - mThreadHandle = PR_CreateThread(PR_USER_THREAD, nsThreadRunner, NS_STATIC_CAST(void*, this), - PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); +nsresult nsPSMBackgroundThread::startThread() +{ + if (!mMutex || !mCond) + return NS_ERROR_OUT_OF_MEMORY; - NS_ASSERTION(mThreadHandle, "Could not create nsPSMBackgroundThread\n"); - } + mThreadHandle = PR_CreateThread(PR_USER_THREAD, nsThreadRunner, NS_STATIC_CAST(void*, this), + PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); + + NS_ASSERTION(mThreadHandle, "Could not create nsPSMBackgroundThread\n"); + + if (!mThreadHandle) + return NS_ERROR_OUT_OF_MEMORY; + + return NS_OK; } nsPSMBackgroundThread::~nsPSMBackgroundThread() diff --git a/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.h b/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.h index 554bf15071f..e790fb18d36 100644 --- a/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.h +++ b/mozilla/security/manager/ssl/src/nsPSMBackgroundThread.h @@ -39,6 +39,7 @@ #define _NSPSMBACKGROUNDTHREAD_H_ #include "nspr.h" +#include "nscore.h" class nsPSMBackgroundThread { @@ -64,7 +65,8 @@ protected: public: nsPSMBackgroundThread(); virtual ~nsPSMBackgroundThread(); - + + nsresult startThread(); void requestExit(); }; diff --git a/mozilla/security/manager/ssl/src/nsSSLThread.cpp b/mozilla/security/manager/ssl/src/nsSSLThread.cpp index 7c4cd3b7767..06d543ffde0 100644 --- a/mozilla/security/manager/ssl/src/nsSSLThread.cpp +++ b/mozilla/security/manager/ssl/src/nsSSLThread.cpp @@ -50,8 +50,6 @@ nsSSLThread::nsSSLThread() NS_ASSERTION(!ssl_thread_singleton, "nsSSLThread is a singleton, caller attempts to create another instance!"); ssl_thread_singleton = this; - - NS_ASSERTION(mThreadHandle, "Could not create nsSSLThreadRunner thread\n"); } nsSSLThread::~nsSSLThread()