Bug 1313740 - Handle null mNewChannel in OverrideWithSynthesizedResponse r=jdm
authorValentin Gosu <valentin.gosu@gmail.com>
Sun, 06 Nov 2016 23:15:51 +0100
changeset 321359 af46e53372abd9a03188e580dbe76ac54f209ed6
parent 321358 81c8a80250c825a973c3e727900202690db8e01c
child 321360 4f657d9e8c8204d43f0cb73f942857f569cba215
push id30926
push userkwierso@gmail.com
push dateMon, 07 Nov 2016 22:02:19 +0000
treeherdermozilla-central@86f702229e32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1313740
milestone52.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 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;