mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-29 18:47:31 +09:00
Bug 1379525 - Part 2: Properly handle rejection in async-from-sync iteration.
Tag #1287
This commit is contained in:
parent
9e8369d01f
commit
586cd0b71b
1 changed files with 5 additions and 1 deletions
|
|
@ -2295,6 +2295,9 @@ static MOZ_MUST_USE bool
|
||||||
InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
|
InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise,
|
||||||
HandleValue onFulfilled, HandleValue onRejected, T extraStep)
|
HandleValue onFulfilled, HandleValue onRejected, T extraStep)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(onFulfilled.isNumber() || onFulfilled.isObject());
|
||||||
|
MOZ_ASSERT(onRejected.isNumber() || onRejected.isObject());
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectWithoutResolutionFunctions(cx));
|
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectWithoutResolutionFunctions(cx));
|
||||||
if (!promise)
|
if (!promise)
|
||||||
|
|
@ -2483,11 +2486,12 @@ js::AsyncFromSyncIteratorMethod(JSContext* cx, CallArgs& args, CompletionKind co
|
||||||
RootedValue onFulfilled(cx, Int32Value(done
|
RootedValue onFulfilled(cx, Int32Value(done
|
||||||
? PromiseHandlerAsyncFromSyncIteratorValueUnwrapDone
|
? PromiseHandlerAsyncFromSyncIteratorValueUnwrapDone
|
||||||
: PromiseHandlerAsyncFromSyncIteratorValueUnwrapNotDone));
|
: PromiseHandlerAsyncFromSyncIteratorValueUnwrapNotDone));
|
||||||
|
RootedValue onRejected(cx, Int32Value(PromiseHandlerThrower));
|
||||||
|
|
||||||
// Steps 11-12, 15.
|
// Steps 11-12, 15.
|
||||||
auto extra = [](Handle<PromiseReactionRecord*> reaction) {
|
auto extra = [](Handle<PromiseReactionRecord*> reaction) {
|
||||||
};
|
};
|
||||||
if (!InternalAwait(cx, value, resultPromise, onFulfilled, UndefinedHandleValue, extra))
|
if (!InternalAwait(cx, value, resultPromise, onFulfilled, onRejected, extra))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Step 16.
|
// Step 16.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue