Bug 1234170 - WebSocket should check if the channel has been opened before send the 'close' notification to the WebSocketEventService, r=jduell a=ritu
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 22 Dec 2015 20:05:07 +0000
changeset 298044 b151c99ab46aa50862189e93a261e31eee5e7db8
parent 298043 18375100124adb724d5b4687685de37a69dcd3df
child 298045 6666e36d154d983416438d97ccb834b26e06c5e5
push id8851
push userkwierso@gmail.com
push dateWed, 23 Dec 2015 20:19:49 +0000
treeherdermozilla-aurora@b151c99ab46a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell, ritu
bugs1234170
milestone45.0a2
Bug 1234170 - WebSocket should check if the channel has been opened before send the 'close' notification to the WebSocketEventService, r=jduell a=ritu
dom/base/WebSocket.cpp
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -1905,19 +1905,21 @@ WebSocket::CreateAndDispatchMessageEvent
 nsresult
 WebSocket::CreateAndDispatchCloseEvent(bool aWasClean,
                                        uint16_t aCode,
                                        const nsAString& aReason)
 {
   MOZ_ASSERT(mImpl);
   AssertIsOnTargetThread();
 
-  mImpl->mService->WebSocketClosed(mImpl->mChannel->Serial(),
-                                   mImpl->mInnerWindowID,
-                                   aWasClean, aCode, aReason);
+  if (mImpl->mChannel) {
+    mImpl->mService->WebSocketClosed(mImpl->mChannel->Serial(),
+                                     mImpl->mInnerWindowID,
+                                     aWasClean, aCode, aReason);
+  }
 
   nsresult rv = CheckInnerWindowCorrectness();
   if (NS_FAILED(rv)) {
     return NS_OK;
   }
 
   CloseEventInit init;
   init.mBubbles = false;