Title: [260915] trunk
Revision
260915
Author
[email protected]
Date
2020-04-29 14:39:40 -0700 (Wed, 29 Apr 2020)

Log Message

AsyncFromSyncIterator methods should not pass absent values
https://bugs.webkit.org/show_bug.cgi?id=211147

Reviewed by Ross Kirsling.

JSTests:

* test262/expectations.yaml: Mark 4 test cases as passing.

Source/_javascript_Core:

This patch implements minor spec change [1] to match async and sync iteration
from the perspective of userland `next` and `return` iterator methods.
`throw` method always receives an argument, yet we align with others to be
consistent and future-proof.

This change is already implemented in SpiderMonkey.

[1]: https://github.com/tc39/ecma262/pull/1776

* builtins/AsyncFromSyncIteratorPrototype.js:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (260914 => 260915)


--- trunk/JSTests/ChangeLog	2020-04-29 21:18:33 UTC (rev 260914)
+++ trunk/JSTests/ChangeLog	2020-04-29 21:39:40 UTC (rev 260915)
@@ -1,3 +1,12 @@
+2020-04-29  Alexey Shvayka  <[email protected]>
+
+        AsyncFromSyncIterator methods should not pass absent values
+        https://bugs.webkit.org/show_bug.cgi?id=211147
+
+        Reviewed by Ross Kirsling.
+
+        * test262/expectations.yaml: Mark 4 test cases as passing.
+
 2020-04-29  Yusuke Suzuki  <[email protected]>
 
         [JSC] JSStringJoiner is missing BigInt handling

Modified: trunk/JSTests/test262/expectations.yaml (260914 => 260915)


--- trunk/JSTests/test262/expectations.yaml	2020-04-29 21:18:33 UTC (rev 260914)
+++ trunk/JSTests/test262/expectations.yaml	2020-04-29 21:39:40 UTC (rev 260915)
@@ -729,12 +729,6 @@
 test/built-ins/ArrayIteratorPrototype/next/detach-typedarray-in-progress.js:
   default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'
   strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)'
-test/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js:
-  default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true'
-  strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true'
-test/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js:
-  default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true'
-  strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true'
 test/built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-promise.js:
   default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: AsyncGeneratorResolve(generator, resultValue, true) Expected SameValue(«[object Promise]», «unwrapped-value») to be true'
   strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: AsyncGeneratorResolve(generator, resultValue, true) Expected SameValue(«[object Promise]», «unwrapped-value») to be true'

Modified: trunk/Source/_javascript_Core/ChangeLog (260914 => 260915)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-29 21:18:33 UTC (rev 260914)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-29 21:39:40 UTC (rev 260915)
@@ -1,3 +1,21 @@
+2020-04-29  Alexey Shvayka  <[email protected]>
+
+        AsyncFromSyncIterator methods should not pass absent values
+        https://bugs.webkit.org/show_bug.cgi?id=211147
+
+        Reviewed by Ross Kirsling.
+
+        This patch implements minor spec change [1] to match async and sync iteration
+        from the perspective of userland `next` and `return` iterator methods.
+        `throw` method always receives an argument, yet we align with others to be
+        consistent and future-proof.
+
+        This change is already implemented in SpiderMonkey.
+
+        [1]: https://github.com/tc39/ecma262/pull/1776
+
+        * builtins/AsyncFromSyncIteratorPrototype.js:
+
 2020-04-29  Mark Lam  <[email protected]>
 
         Freezing of Gigacage and JSC Configs should be thread safe.

Modified: trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js (260914 => 260915)


--- trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js	2020-04-29 21:18:33 UTC (rev 260914)
+++ trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js	2020-04-29 21:39:40 UTC (rev 260915)
@@ -36,9 +36,10 @@
     }
 
     var syncIterator = @getByIdDirectPrivate(this, "syncIterator");
+    var nextMethod = @getByIdDirectPrivate(this, "nextMethod");
 
     try {
-        var nextResult = @getByIdDirectPrivate(this, "nextMethod").@call(syncIterator, value);
+        var nextResult = @argumentCount() === 0 ? nextMethod.@call(syncIterator) : nextMethod.@call(syncIterator, value);
         var nextDone = !!nextResult.done;
         var nextValue = nextResult.value;
         @resolveWithoutPromise(nextValue,
@@ -79,7 +80,7 @@
     }
     
     try {
-        var returnResult = returnMethod.@call(syncIterator, value);
+        var returnResult = @argumentCount() === 0 ? returnMethod.@call(syncIterator) : returnMethod.@call(syncIterator, value);
 
         if (!@isObject(returnResult)) {
             @rejectPromiseWithFirstResolvingFunctionCallCheck(promise, @makeTypeError('Iterator result interface is not an object.'));
@@ -126,7 +127,7 @@
     }
     
     try {
-        var throwResult = throwMethod.@call(syncIterator, exception);
+        var throwResult = @argumentCount() === 0 ? throwMethod.@call(syncIterator) : throwMethod.@call(syncIterator, exception);
         
         if (!@isObject(throwResult)) {
             @rejectPromiseWithFirstResolvingFunctionCallCheck(promise, @makeTypeError('Iterator result interface is not an object.'));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to