bug 712572 part 1 r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Fri, 06 Jan 2012 14:54:13 -0500
changeset 85189 5cabc9128f1eef2f3a96a10f2136c2d22d4f42dd
parent 85188 909cbc7fa325649c25ec4c3e481012e173116ef2
child 85190 b971ace649b2cc1089241360f1ca53ca6bd8c966
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs712572
milestone12.0a1
bug 712572 part 1 r=jduell
netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -155,16 +155,17 @@ public:
 
   CallOnStop(WebSocketChannel *aChannel,
              nsresult          aData)
     : mChannel(aChannel),
       mData(aData) {}
 
   NS_IMETHOD Run()
   {
+    NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");
     mChannel->mListener->OnStop(mChannel->mContext, mData);
     return NS_OK;
   }
 
 private:
   ~CallOnStop() {}
 
   nsRefPtr<WebSocketChannel>        mChannel;
@@ -1679,20 +1680,20 @@ WebSocketChannel::AbortSession(nsresult 
 
   if (mStopped)
     return;
   mStopped = 1;
 
   if (mTransport && reason != NS_BASE_STREAM_CLOSED &&
       !mRequestedClose && !mClientClosed && !mServerClosed) {
     mRequestedClose = 1;
+    mStopOnClose = reason;
     mSocketThread->Dispatch(
       new OutboundEnqueuer(this, new OutboundMessage(kMsgTypeFin, nsnull)),
                            nsIEventTarget::DISPATCH_NORMAL);
-    mStopOnClose = reason;
   } else {
     StopSession(reason);
   }
 }
 
 // ReleaseSession is called on orderly shutdown
 void
 WebSocketChannel::ReleaseSession()