bug 704004 websockets null check of channel before calling close on it r=jduell a=legneato
authorPatrick McManus <mcmanus@ducksong.com>
Mon, 28 Nov 2011 17:28:33 -0500
changeset 81406 e6dc2e6428248c2527c5e91d18a540202246ab20
parent 81405 69482d1fd0368ce9cf3a2aec4977651427e7d293
child 81407 b0708d07213142365f4c66dfc593e24f9eccf2b9
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell, legneato
bugs704004
milestone10.0a2
bug 704004 websockets null check of channel before calling close on it r=jduell a=legneato
content/base/src/nsWebSocket.cpp
--- a/content/base/src/nsWebSocket.cpp
+++ b/content/base/src/nsWebSocket.cpp
@@ -159,17 +159,18 @@ nsWebSocket::CloseConnection()
     return NS_OK;
 
   // Disconnect() can release this object, so we keep a
   // reference until the end of the method
   nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
 
   if (mReadyState == nsIMozWebSocket::CONNECTING) {
     SetReadyState(nsIMozWebSocket::CLOSED);
-    mWebSocketChannel->Close(mClientReasonCode, mClientReason);
+    if (mWebSocketChannel)
+      mWebSocketChannel->Close(mClientReasonCode, mClientReason);
     Disconnect();
     return NS_OK;
   }
 
   SetReadyState(nsIMozWebSocket::CLOSING);
 
   if (mDisconnected) {
     SetReadyState(nsIMozWebSocket::CLOSED);