Bug 1363659 - Ensure not sending data channel constructor when shutting down, r=valentin
authorJunior Hsu <juhsu@mozilla.com>
Fri, 26 May 2017 03:09:00 +0200
changeset 409303 8806b294e566770ebbf73daee9dfe8f69b67885e
parent 409302 ad232f31e5a076ef8c5f91fb7fe2ccc9cb6a2cb9
child 409304 dcbaf5f542b6c45312a72621e539ca79e10fc2b5
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1363659
milestone55.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 1363659 - Ensure not sending data channel constructor when shutting down, r=valentin
netwerk/protocol/data/DataChannelChild.cpp
--- a/netwerk/protocol/data/DataChannelChild.cpp
+++ b/netwerk/protocol/data/DataChannelChild.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=4 sw=4 sts=4 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DataChannelChild.h"
 
 #include "mozilla/Unused.h"
+#include "mozilla/dom/ContentChild.h"
 #include "mozilla/net/NeckoChild.h"
 
 namespace mozilla {
 namespace net {
 
 NS_IMPL_ISUPPORTS_INHERITED(DataChannelChild, nsDataChannel, nsIChildChannel)
 
 DataChannelChild::DataChannelChild(nsIURI* aURI)
@@ -22,16 +23,22 @@ DataChannelChild::DataChannelChild(nsIUR
 
 DataChannelChild::~DataChannelChild()
 {
 }
 
 NS_IMETHODIMP
 DataChannelChild::ConnectParent(uint32_t aId)
 {
+    mozilla::dom::ContentChild* cc =
+        static_cast<mozilla::dom::ContentChild*>(gNeckoChild->Manager());
+    if (cc->IsShuttingDown()) {
+        return NS_ERROR_FAILURE;
+    }
+
     if (!gNeckoChild->SendPDataChannelConstructor(this, aId)) {
         return NS_ERROR_FAILURE;
     }
 
     // IPC now has a ref to us.
     AddIPDLReference();
     return NS_OK;
 }