Bug 1325655 - Let HttpChannelParent::ConnectChannel hard-fail when no nsHttpChannel is not found registered. r=jduell a=gchang
authorHonza Bambas <honzab.moz@firemni.cz>
Tue, 17 Jan 2017 07:50:00 -0500
changeset 376017 73aac08829e835e6707b30fb6f0df3e2e0fe0e5d
parent 376016 17b27168189deae84a92173000866595c5e81483
child 376018 8eb9b71cc50a07d8412d083da69ee733c6d8a80f
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell, gchang
bugs1325655
milestone53.0a2
Bug 1325655 - Let HttpChannelParent::ConnectChannel hard-fail when no nsHttpChannel is not found registered. r=jduell a=gchang
netwerk/protocol/http/HttpChannelParent.cpp
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -595,16 +595,21 @@ HttpChannelParent::ConnectChannel(const 
   nsCOMPtr<nsIChannel> channel;
   rv = NS_LinkRedirectChannels(registrarId, this, getter_AddRefs(channel));
   // It's safe to cast here since the found parent-side real channel is ensured
   // to be http (nsHttpChannel).  ConnectChannel called from HttpChannelParent::Init
   // can only be called for http channels.  It's bound by ipdl.
   mChannel = static_cast<nsHttpChannel*>(channel.get());
   LOG(("  found channel %p, rv=%08x", mChannel.get(), rv));
 
+  if (NS_FAILED(rv)) {
+    NS_ERROR("Could not find the http channel to connect its IPC parent");
+    return false;
+  }
+
   nsCOMPtr<nsINetworkInterceptController> controller;
   NS_QueryNotificationCallbacks(channel, controller);
   RefPtr<HttpChannelParentListener> parentListener = do_QueryObject(controller);
   MOZ_ASSERT(parentListener);
   parentListener->SetupInterceptionAfterRedirect(shouldIntercept);
 
   if (mPBOverride != kPBOverride_Unset) {
     // redirected-to channel may not support PB