Bug 1313740 - Handle null mNewChannel in OverrideWithSynthesizedResponse r=jdm, a=gchang
authorValentin Gosu <valentin.gosu@gmail.com>
Sun, 06 Nov 2016 23:15:51 +0100
changeset 340974 8cc3ea80f82cbea2f8293058bce7f4768bce7b83
parent 340973 fa5bb25eb05ff73bb23c06cde372db389d8eb030
child 340975 70373ca1b5bea0015ff29d644316c44477d5675f
push id10266
push usercbook@mozilla.com
push dateThu, 10 Nov 2016 15:43:38 +0000
treeherdermozilla-aurora@70373ca1b5be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, gchang
bugs1313740
milestone51.0a2
Bug 1313740 - Handle null mNewChannel in OverrideWithSynthesizedResponse r=jdm, a=gchang MozReview-Commit-ID: 702H0eJKdx1
netwerk/protocol/http/HttpChannelChild.cpp
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1148,17 +1148,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
@@ -1688,19 +1690,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;