mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
1320408 - Part 20: Change PromiseObject::resolve and PromiseObject::reject to static method.
This commit is contained in:
parent
62eeeb76b5
commit
e5b36e01b9
4 changed files with 22 additions and 20 deletions
|
|
@ -2631,14 +2631,14 @@ PromiseObject::dependentPromises(JSContext* cx, MutableHandle<GCVector<Value>> v
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
PromiseObject::resolve(JSContext* cx, HandleValue resolutionValue)
|
||||
/* static */ bool
|
||||
PromiseObject::resolve(JSContext* cx, Handle<PromiseObject*> promise, HandleValue resolutionValue)
|
||||
{
|
||||
MOZ_ASSERT(!PromiseHasAnyFlag(*this, PROMISE_FLAG_ASYNC));
|
||||
if (state() != JS::PromiseState::Pending)
|
||||
MOZ_ASSERT(!PromiseHasAnyFlag(*promise, PROMISE_FLAG_ASYNC));
|
||||
if (promise->state() != JS::PromiseState::Pending)
|
||||
return true;
|
||||
|
||||
RootedObject resolveFun(cx, GetResolveFunctionFromPromise(this));
|
||||
RootedObject resolveFun(cx, GetResolveFunctionFromPromise(promise));
|
||||
RootedValue funVal(cx, ObjectValue(*resolveFun));
|
||||
|
||||
// For xray'd Promises, the resolve fun may have been created in another
|
||||
|
|
@ -2654,14 +2654,14 @@ PromiseObject::resolve(JSContext* cx, HandleValue resolutionValue)
|
|||
return Call(cx, funVal, UndefinedHandleValue, args, &dummy);
|
||||
}
|
||||
|
||||
bool
|
||||
PromiseObject::reject(JSContext* cx, HandleValue rejectionValue)
|
||||
/* static */ bool
|
||||
PromiseObject::reject(JSContext* cx, Handle<PromiseObject*> promise, HandleValue rejectionValue)
|
||||
{
|
||||
MOZ_ASSERT(!PromiseHasAnyFlag(*this, PROMISE_FLAG_ASYNC));
|
||||
if (state() != JS::PromiseState::Pending)
|
||||
MOZ_ASSERT(!PromiseHasAnyFlag(*promise, PROMISE_FLAG_ASYNC));
|
||||
if (promise->state() != JS::PromiseState::Pending)
|
||||
return true;
|
||||
|
||||
RootedValue funVal(cx, this->getFixedSlot(PromiseSlot_RejectFunction));
|
||||
RootedValue funVal(cx, promise->getFixedSlot(PromiseSlot_RejectFunction));
|
||||
MOZ_ASSERT(IsCallable(funVal));
|
||||
|
||||
FixedInvokeArgs<1> args(cx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue