Bug 757738 - Websockets: release reference to nsIWebSocketListener after OnClose. r=mcmanus

This commit is contained in:
Jason Duell
2012-06-29 23:02:08 -07:00
parent 4eb7157e0c
commit fb496cac16
2 changed files with 9 additions and 3 deletions

View File

@@ -535,8 +535,11 @@ public:
sWebSocketAdmissions->OnStopSession(mChannel, mReason);
if (mChannel->mListener)
if (mChannel->mListener) {
mChannel->mListener->OnStop(mChannel->mContext, mReason);
mChannel->mListener = nsnull;
mChannel->mContext = nsnull;
}
return NS_OK;
}

View File

@@ -29,8 +29,11 @@ interface nsIWebSocketListener : nsISupports
/**
* Called to signify the completion of the message stream.
* OnStop is the final notification the listener will receive and it
* completes the WebSocket connection. This event can be received in error
* cases even if nsIWebSocketChannel::Close() has not been called.
* completes the WebSocket connection: after it returns the
* nsIWebSocketChannel will release its reference to the listener.
*
* Note: this event can be received in error cases even if
* nsIWebSocketChannel::Close() has not been called.
*
* @param aContext user defined context
* @param aStatusCode reason for stopping (NS_OK if completed successfully)