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

--HG--
extra : rebase_source : 44758e1f0eabfe0b02b654dd48317f320b79a217
This commit is contained in:
Blake Kaplan 2017-07-28 16:35:25 -07:00
parent 4837c778e7
commit 4d5da90a53

View File

@ -70,7 +70,10 @@ ExternalHelperAppChild::OnStartRequest(nsIRequest *request, nsISupports *ctx)
// 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) {