diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-12-14 10:32:39 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-12-17 06:25:30 -0500 |
commit | 4a5ed79c6c5b73ac010a80c2fa5c3d6545278243 (patch) | |
tree | 3b36421bd16cb07489c26ff13dbed6890cde4ed5 /js/src/builtin | |
parent | 38c1d558afd03d61bd9932032f47d9c36f177b08 (diff) | |
download | UXP-4a5ed79c6c5b73ac010a80c2fa5c3d6545278243.tar UXP-4a5ed79c6c5b73ac010a80c2fa5c3d6545278243.tar.gz UXP-4a5ed79c6c5b73ac010a80c2fa5c3d6545278243.tar.lz UXP-4a5ed79c6c5b73ac010a80c2fa5c3d6545278243.tar.xz UXP-4a5ed79c6c5b73ac010a80c2fa5c3d6545278243.zip |
Bug 1379525 - Part 2: Properly handle rejection in async-from-sync iteration.
Tag #1287
Diffstat (limited to 'js/src/builtin')
-rw-r--r-- | js/src/builtin/Promise.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp index 62c5eb429..4900a91cb 100644 --- a/js/src/builtin/Promise.cpp +++ b/js/src/builtin/Promise.cpp @@ -2295,6 +2295,9 @@ static MOZ_MUST_USE bool InternalAwait(JSContext* cx, HandleValue value, HandleObject resultPromise, HandleValue onFulfilled, HandleValue onRejected, T extraStep) { + MOZ_ASSERT(onFulfilled.isNumber() || onFulfilled.isObject()); + MOZ_ASSERT(onRejected.isNumber() || onRejected.isObject()); + // Step 2. Rooted<PromiseObject*> promise(cx, CreatePromiseObjectWithoutResolutionFunctions(cx)); if (!promise) @@ -2483,11 +2486,12 @@ js::AsyncFromSyncIteratorMethod(JSContext* cx, CallArgs& args, CompletionKind co RootedValue onFulfilled(cx, Int32Value(done ? PromiseHandlerAsyncFromSyncIteratorValueUnwrapDone : PromiseHandlerAsyncFromSyncIteratorValueUnwrapNotDone)); + RootedValue onRejected(cx, Int32Value(PromiseHandlerThrower)); // Steps 11-12, 15. auto extra = [](Handle<PromiseReactionRecord*> reaction) { }; - if (!InternalAwait(cx, value, resultPromise, onFulfilled, UndefinedHandleValue, extra)) + if (!InternalAwait(cx, value, resultPromise, onFulfilled, onRejected, extra)) return false; // Step 16. |