Bug 1644009 - P14. Fallback to normal dispatch on release. r=bholley

We shouldn't ever get there, but just in case, better than a null deref.

Differential Revision: https://phabricator.services.mozilla.com/D79097
This commit is contained in:
Jean-Yves Avenard 2020-06-12 05:10:57 +00:00
parent a56b255f0f
commit 4e41c1b386

View File

@ -478,19 +478,19 @@ class MozPromise : public MozPromiseBase {
this);
nsCOMPtr<nsIDirectTaskDispatcher> dispatcher =
do_QueryInterface(mResponseTarget);
if (!dispatcher) {
NS_WARNING(
nsPrintfCString(
"Direct Task dispatching not available for thread \"%s\"",
PR_GetThreadName(PR_GetCurrentThread()))
.get());
MOZ_DIAGNOSTIC_ASSERT(
false,
"mResponseTarget must implement nsIDirectTaskDispatcher for "
"direct task dispatching");
if (dispatcher) {
dispatcher->DispatchDirectTask(r.forget());
return;
}
dispatcher->DispatchDirectTask(r.forget());
return;
NS_WARNING(
nsPrintfCString(
"Direct Task dispatching not available for thread \"%s\"",
PR_GetThreadName(PR_GetCurrentThread()))
.get());
MOZ_DIAGNOSTIC_ASSERT(
false,
"mResponseTarget must implement nsIDirectTaskDispatcher for direct "
"task dispatching");
}
// Promise consumers are allowed to disconnect the Request object and