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
--- 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));