Skip to content

Commit

Permalink
Bug 1629794: Handle absent arguments in AsyncFromSyncIteratorPrototyp…
Browse files Browse the repository at this point in the history
…e. r=yulia

We're using a shared implementation for the "next", "return", and "throw"
methods, so we only need to adjust a single line of code.

Spec PR: tc39/ecma262#1776

Depends on D70815

Differential Revision: https://phabricator.services.mozilla.com/D70816

--HG--
extra : moz-landing-system : lando
  • Loading branch information
anba committed Apr 14, 2020
1 parent cbef056 commit d6a7fbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 9 additions & 1 deletion js/src/builtin/Promise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4615,9 +4615,17 @@ bool js::AsyncFromSyncIteratorMethod(JSContext* cx, CallArgs& args,
// return/throw() steps 8-9.
// Step 8: Let result be Call(throw, syncIterator, « value »).
// Step 9: IfAbruptRejectPromise(result, promiseCapability).
//
// Including the changes from: https://github.com/tc39/ecma262/pull/1776
RootedValue iterVal(cx, ObjectValue(*iter));
RootedValue resultVal(cx);
if (!Call(cx, func, iterVal, args.get(0), &resultVal)) {
bool ok;
if (args.length() == 0) {
ok = Call(cx, func, iterVal, &resultVal);
} else {
ok = Call(cx, func, iterVal, args[0], &resultVal);
}
if (!ok) {
return AbruptRejectPromise(cx, args, resultPromise, nullptr);
}

Expand Down
5 changes: 0 additions & 5 deletions js/src/tests/jstests.list
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,6 @@ skip script test262/language/statements/for-await-of/iterator-close-throw-get-me
skip script test262/language/statements/for-of/iterator-close-throw-get-method-non-callable.js
skip script test262/language/statements/for-of/iterator-close-throw-get-method-abrupt.js

# https://github.com/tc39/ecma262/pull/1776
# https://bugzilla.mozilla.org/show_bug.cgi?id=1629794
skip script test262/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js
skip script test262/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js


###########################################################
# Tests disabled due to issues in test262 importer script #
Expand Down

0 comments on commit d6a7fbe

Please sign in to comment.