Bug 1381934 - Try to deal better with closed windows. r=mconley
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 28 Jul 2017 16:35:25 -0700
changeset 420800 713ec2a7dc6ca812cd93aacdc6c2ec690db21486
parent 420799 0f6f2d7421e6dcc5aaecef906cbcba65726494cd
child 420801 9417de5e94b495c8f3225c652d1c2854a33865c1
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1381934
milestone56.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 1381934 - Try to deal better with closed windows. r=mconley It's hard to know exactly what's going on in this testcase because we nest a bunch of calls. I was unable to observe the crash myself, but it appears that part of it (at least) has to do with the test timing out and causing the opened page to get closed by the harness. I believe this causes us to fail to getInterface to the docShell for the now-closed window and we crash. There isn't much we can do in this situation so, let's try being defensive and watch crash-stats. MozReview-Commit-ID: EeSUqMPXk58
uriloader/exthandler/ExternalHelperAppChild.cpp
--- a/uriloader/exthandler/ExternalHelperAppChild.cpp
+++ b/uriloader/exthandler/ExternalHelperAppChild.cpp
@@ -65,17 +65,20 @@ ExternalHelperAppChild::OnStartRequest(n
   NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
 
   // Calling OnStartRequest could cause mHandler to close the window it was
   // 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());
-  TabChild *tabChild = window ? mozilla::dom::TabChild::GetFrom(window) : nullptr;
+  NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
+
+  TabChild *tabChild = mozilla::dom::TabChild::GetFrom(window);
+  MOZ_ASSERT(tabChild);
 
   nsCOMPtr<nsIDivertableChannel> divertable = do_QueryInterface(request);
   if (divertable) {
     return DivertToParent(divertable, request, tabChild);
   }
 
   nsCString entityID;
   nsCOMPtr<nsIResumableChannel> resumable(do_QueryInterface(request));