Bug 663893 - Avoid null dereferences in websocket handler. r=mcmanus

This commit is contained in:
Josh Matthews 2011-06-13 14:30:07 -04:00
parent 7c55737ac3
commit c0c46e51bd

View File

@ -865,9 +865,11 @@ nsWebSocketHandler::ProcessInput(PRUint8 *buffer, PRUint32 count)
mCloseTimer->Cancel();
mCloseTimer = nsnull;
}
nsCOMPtr<nsIRunnable> event =
new CallOnServerClose(mListener, mContext);
NS_DispatchToMainThread(event);
if (mListener) {
nsCOMPtr<nsIRunnable> event =
new CallOnServerClose(mListener, mContext);
NS_DispatchToMainThread(event);
}
if (mClientClosed)
ReleaseSession();
@ -1314,9 +1316,11 @@ nsWebSocketHandler::StopSession(nsresult reason)
if (!mCalledOnStop) {
mCalledOnStop = 1;
nsCOMPtr<nsIRunnable> event =
new CallOnStop(mListener, mContext, reason);
NS_DispatchToMainThread(event);
if (mListener) {
nsCOMPtr<nsIRunnable> event =
new CallOnStop(mListener, mContext, reason);
NS_DispatchToMainThread(event);
}
}
return;