Bug 1359951 - Ensure that the WebSocket not sending constructor when shutting down, r=nwgh
authorJunior Hsu <juhsu@mozilla.com>
Tue, 02 May 2017 19:50:00 +0200
changeset 572792 816f2cd29ba688e49c9f23ae6ccfd80946d71b34
parent 572791 2b5df4f239deb22a8e984835c4d1068e95649b1a
child 572793 c0e3f3edf36a8486c22d88e0d28f337690e439ff
push id57195
push userbmo:rbarker@mozilla.com
push dateThu, 04 May 2017 20:08:56 +0000
reviewersnwgh
bugs1359951
milestone55.0a1
Bug 1359951 - Ensure that the WebSocket not sending constructor when shutting down, r=nwgh
netwerk/protocol/websocket/WebSocketChannelChild.cpp
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -523,16 +523,21 @@ WebSocketChannelChild::AsyncOpen(nsIURI 
                                 getter_AddRefs(iTabChild));
   if (iTabChild) {
     tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
   }
   if (MissingRequiredTabChild(tabChild, "websocket")) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
+  ContentChild* cc = static_cast<ContentChild*>(gNeckoChild->Manager());
+  if (cc->IsShuttingDown()) {
+    return NS_ERROR_FAILURE;
+  }
+
   // Corresponding release in DeallocPWebSocket
   AddIPDLReference();
 
   OptionalURIParams uri;
   OptionalLoadInfoArgs loadInfoArgs;
   OptionalTransportProvider transportProvider;
 
   if (!mIsServerSide) {