commit d4789cb490686e477365d554ccf18a49c50770e6
parent d999a8ab50b151c28ef33c2009a37554e9a315de
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date: Wed, 15 Oct 2025 11:15:54 +0000
Bug 1989918 - Add warning when dispatch from DNSListenerProxy::OnLookupComplete fails r=necko-reviewers,jesup
The runnable will be leaked when dispatch fails.
This patch adds a NS_WARNING to make it easier to identify when that happens.
Differential Revision: https://phabricator.services.mozilla.com/D268686
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/netwerk/dns/DNSListenerProxy.cpp b/netwerk/dns/DNSListenerProxy.cpp
@@ -23,7 +23,7 @@ DNSListenerProxy::OnLookupComplete(nsICancelable* aRequest,
RefPtr<DNSListenerProxy> self = this;
nsCOMPtr<nsICancelable> request = aRequest;
nsCOMPtr<nsIDNSRecord> record = aRecord;
- return mTargetThread->Dispatch(
+ nsresult rv = mTargetThread->Dispatch(
NS_NewRunnableFunction("DNSListenerProxy::OnLookupComplete",
[self, request, record, aStatus]() {
Unused << self->mListener->OnLookupComplete(
@@ -31,6 +31,10 @@ DNSListenerProxy::OnLookupComplete(nsICancelable* aRequest,
self->mListener = nullptr;
}),
NS_DISPATCH_NORMAL);
+ if (NS_FAILED(rv)) {
+ NS_WARNING("DNSListenerProxy::OnLookupComplete dispatch failed.");
+ }
+ return rv;
}
} // namespace net