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
--- a/toolkit/components/extensions/webrequest/StreamFilterParent.cpp
+++ b/toolkit/components/extensions/webrequest/StreamFilterParent.cpp
@@ -413,18 +413,21 @@ StreamFilterParent::OnStartRequest(nsIRe
});
}
nsresult rv = mOrigListener->OnStartRequest(aRequest, 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;
}
NS_IMETHODIMP
StreamFilterParent::OnStopRequest(nsIRequest* aRequest,
nsISupports* aContext,