Bug 1452245 - The parent side isn't closed if the child dies unexpectedly, r=valentin
authorFabrice Desré <fabrice@desre.org>
Wed, 23 May 2018 15:22:00 +0300
changeset 419658 7b99c5f0b05eae19a93699766a957ee658fb6856
parent 419657 10f52bc1b0a47a7f0ca708d0f78e2b4d03e438c6
child 419659 043e4ab6e72469ed8121f4da98dcdfef983a49d9
child 419673 eea17fb776842aa503b019496b874efa6a00b55d
push id34041
push userebalazs@mozilla.com
push dateThu, 24 May 2018 09:38:21 +0000
treeherdermozilla-central@043e4ab6e724 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1452245
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452245 - The parent side isn't closed if the child dies unexpectedly, r=valentin
netwerk/protocol/websocket/WebSocketChannelParent.cpp
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -278,16 +278,24 @@ WebSocketChannelParent::OnServerClose(ns
   }
   return NS_OK;
 }
 
 void
 WebSocketChannelParent::ActorDestroy(ActorDestroyReason why)
 {
   LOG(("WebSocketChannelParent::ActorDestroy() %p\n", this));
+
+  // Make sure we close the channel if the content process dies without going
+  // through a clean shutdown.
+  if (mChannel) {
+    Unused << mChannel->Close(nsIWebSocketChannel::CLOSE_GOING_AWAY,
+                              NS_LITERAL_CSTRING("Child was killed"));
+  }
+
   mIPCOpen = false;
 }
 
 //-----------------------------------------------------------------------------
 // WebSocketChannelParent::nsIInterfaceRequestor
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP