Bug 1233962 P1 Call ResetInterception() if the controller is nullptr. r=jdm a=ritu
authorBen Kelly <ben@wanderview.com>
Tue, 22 Dec 2015 11:57:10 -0800
changeset 305880 e8887f01eebab619627735bad0d1126c86a5d1ad
parent 305879 0413edcf9ca4152d9cb97a8efdeacc06982597ff
child 305881 6c6b6dc18c7629e915ef86a3e6384e199ab49257
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, ritu
bugs1233962
milestone44.0
Bug 1233962 P1 Call ResetInterception() if the controller is nullptr. r=jdm a=ritu
netwerk/protocol/http/InterceptedChannel.cpp
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -59,24 +59,31 @@ InterceptedChannelBase::EnsureSynthesize
   if (mSynthesizedResponseHead.isNothing()) {
     mSynthesizedResponseHead.emplace(new nsHttpResponseHead());
   }
 }
 
 void
 InterceptedChannelBase::DoNotifyController()
 {
-    nsCOMPtr<nsIFetchEventDispatcher> dispatcher;
-    nsresult rv = mController->ChannelIntercepted(this,
-                                                  getter_AddRefs(dispatcher));
-    if (NS_WARN_IF(NS_FAILED(rv))) {
+    nsresult rv = NS_OK;
+
+    if (NS_WARN_IF(!mController)) {
       rv = ResetInterception();
       NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
+      return;
     }
-    if (dispatcher) {
+
+    nsCOMPtr<nsIFetchEventDispatcher> dispatcher;
+    rv = mController->ChannelIntercepted(this, getter_AddRefs(dispatcher));
+
+    if (NS_WARN_IF(NS_FAILED(rv) || !dispatcher)) {
+      rv = ResetInterception();
+      NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
+    } else {
       rv = dispatcher->Dispatch();
       if (NS_WARN_IF(NS_FAILED(rv))) {
         rv = ResetInterception();
         NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
       }
     }
     mController = nullptr;
 }