Bug 1414549: Correctly handle GetDeliveryTarget failure. r=mixedpuppy

getter_AddRefs nulls its parameter before passing it to the getter function,
which means that on failure, we wind up with a null IO thread, rather than its
original main thread value.

MozReview-Commit-ID: 1SSIeNtiBq9

--HG--
extra : rebase_source : 05e4437e86ab4036e93e2577f46ff0cfd0a3d329
This commit is contained in:
Kris Maglione 2017-11-05 19:22:38 -08:00
parent 3699fb8ded
commit e32e9e2376

View File

@ -418,8 +418,11 @@ StreamFilterParent::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
// Important: Do this only *after* running the next listener in the chain, so
// that we get the final delivery target after any retargeting that it may do.
if (nsCOMPtr<nsIThreadRetargetableRequest> req = do_QueryInterface(aRequest)) {
Unused << req->GetDeliveryTarget(getter_AddRefs(mIOThread));
MOZ_ASSERT(mIOThread);
nsCOMPtr<nsIEventTarget> thread;
Unused << req->GetDeliveryTarget(getter_AddRefs(thread));
if (thread) {
mIOThread = Move(thread);
}
}
return rv;