Bug 1313740 - Handle null mNewChannel in OverrideWithSynthesizedResponse r=jdm
authorValentin Gosu <valentin.gosu@gmail.com>
Sun, 06 Nov 2016 23:15:51 +0100
changeset 348052 af46e53372abd9a03188e580dbe76ac54f209ed6
parent 348051 81c8a80250c825a973c3e727900202690db8e01c
child 348053 4f657d9e8c8204d43f0cb73f942857f569cba215
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1313740
milestone52.0a1
Bug 1313740 - Handle null mNewChannel in OverrideWithSynthesizedResponse r=jdm MozReview-Commit-ID: 702H0eJKdx1
netwerk/protocol/http/HttpChannelChild.cpp
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1165,17 +1165,19 @@ HttpChannelChild::OverrideRunnable::Over
   mListener = aListener;
   mInput = aInput;
   mHead = aHead;
 }
 
 void
 HttpChannelChild::OverrideRunnable::OverrideWithSynthesizedResponse()
 {
-  mNewChannel->OverrideWithSynthesizedResponse(mHead, mInput, mListener);
+  if (mNewChannel) {
+    mNewChannel->OverrideWithSynthesizedResponse(mHead, mInput, mListener);
+  }
 }
 
 NS_IMETHODIMP
 HttpChannelChild::OverrideRunnable::Run()
 {
   bool ret = mChannel->Redirect3Complete(this);
 
   // If the method returns false, it means the IPDL connection is being
@@ -1705,19 +1707,20 @@ HttpChannelChild::OnRedirectVerifyCallba
     if (NS_SUCCEEDED(rv) && newLoadInfo) {
       forceHSTSPriming = newLoadInfo->GetForceHSTSPriming();
       mixedContentWouldBlock = newLoadInfo->GetMixedContentWouldBlock();
     }
   }
 
   if (mRedirectingForSubsequentSynthesizedResponse) {
     nsCOMPtr<nsIHttpChannelChild> httpChannelChild = do_QueryInterface(mRedirectChannelChild);
-    MOZ_ASSERT(httpChannelChild);
     RefPtr<HttpChannelChild> redirectedChannel =
         static_cast<HttpChannelChild*>(httpChannelChild.get());
+    // redirectChannel will be NULL if mRedirectChannelChild isn't a
+    // nsIHttpChannelChild (it could be a DataChannelChild).
 
     RefPtr<InterceptStreamListener> streamListener =
         new InterceptStreamListener(redirectedChannel, mListenerContext);
 
     NS_DispatchToMainThread(new OverrideRunnable(this, redirectedChannel,
                                                  streamListener, mSynthesizedInput,
                                                  mResponseHead));
     return NS_OK;