Bug 1368343 - Be paranoid about null TabChild. r=mconley draft
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 31 Aug 2017 16:54:31 -0700
changeset 657003 50d77b391372bc41497450a67e0fdf6727a6477e
parent 655385 db7f19e26e571ae1dd309f5d2f387b06ba670c30
child 729312 af5087e5db30cc25023ee528d459e8803ab20cfa
push id77403
push userbmo:mrbkap@mozilla.com
push dateThu, 31 Aug 2017 23:56:51 +0000
reviewersmconley
bugs1368343
milestone57.0a1
Bug 1368343 - Be paranoid about null TabChild. r=mconley I had a theory about what was happening (that we're somehow closing the window between the attempt to open the channel and the resulting OnStartRequest), but when I attempted to test that I couldn't make it crash (in fact, closing the window calls Cancel on the stream and stops the OnStartRequest from happening). So, I don't know what's causing this, but clearly we're failing to get a TabChild out, so let's stop crashing for the time being. MozReview-Commit-ID: LeGJCvh26dm
uriloader/exthandler/ExternalHelperAppChild.cpp
--- a/uriloader/exthandler/ExternalHelperAppChild.cpp
+++ b/uriloader/exthandler/ExternalHelperAppChild.cpp
@@ -68,17 +68,17 @@ ExternalHelperAppChild::OnStartRequest(n
   // loaded for. In that case, the TabParent in the parent context might then
   // point to the wrong window. Re-send the window context along with either
   // DivertToParent or SendOnStartRequest just in case.
   nsCOMPtr<nsPIDOMWindowOuter> window =
     do_GetInterface(mHandler->GetDialogParent());
   NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
 
   TabChild *tabChild = mozilla::dom::TabChild::GetFrom(window);
-  MOZ_ASSERT(tabChild);
+  NS_ENSURE_TRUE(tabChild, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIDivertableChannel> divertable = do_QueryInterface(request);
   if (divertable) {
     return DivertToParent(divertable, request, tabChild);
   }
 
   nsCString entityID;
   nsCOMPtr<nsIResumableChannel> resumable(do_QueryInterface(request));