mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1917665 - Return early on MaybeSomething if PromiseObj is null r=smaug
Promise::CreateInfallible allows not having PromiseObj but MaybeSomething still had an invalid assertion. MaybeSomething eventually calls MaybeReject/Resolve which safely checks PromiseObj ultimately, but why go further when we can return early. Differential Revision: https://phabricator.services.mozilla.com/D228465
This commit is contained in:
parent
5e9b4b9fc1
commit
377f4a1431
@ -423,7 +423,9 @@ class Promise : public SupportsWeakPtr {
|
||||
|
||||
template <typename T>
|
||||
void MaybeSomething(T&& aArgument, MaybeFunc aFunc) {
|
||||
MOZ_ASSERT(PromiseObj()); // It was preserved!
|
||||
if (NS_WARN_IF(!PromiseObj())) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoAllowLegacyScriptExecution exemption;
|
||||
AutoEntryScript aes(mGlobal, "Promise resolution or rejection");
|
||||
|
Loading…
Reference in New Issue
Block a user