Changeset 267125 in webkit


Ignore:
Timestamp:
Sep 15, 2020 6:17:07 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Check whether the iterator is callable in spread
https://bugs.webkit.org/show_bug.cgi?id=215974

Patch by HyeockJin Kim <kherootz@gmail.com> on 2020-09-15
Reviewed by Darin Adler.

JSTests:

  • stress/spread-array-iterator.js: Added.

(shouldThrowTypeError):
(shouldThrowExactly):
(f):
(C):

Source/JavaScriptCore:

  • builtins/IteratorHelpers.js:

(performIteration):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r267115 r267125  
     12020-09-15  HyeockJin Kim  <kherootz@gmail.com>
     2
     3        Check whether the iterator is callable in spread
     4        https://bugs.webkit.org/show_bug.cgi?id=215974
     5
     6        Reviewed by Darin Adler.
     7
     8        * stress/spread-array-iterator.js: Added.
     9        (shouldThrowTypeError):
     10        (shouldThrowExactly):
     11        (f):
     12        (C):
     13
    1142020-09-15  Yusuke Suzuki  <ysuzuki@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r267114 r267125  
     12020-09-15  HyeockJin Kim  <kherootz@gmail.com>
     2
     3        Check whether the iterator is callable in spread
     4        https://bugs.webkit.org/show_bug.cgi?id=215974
     5
     6        Reviewed by Darin Adler.
     7
     8        * builtins/IteratorHelpers.js:
     9        (performIteration):
     10
    1112020-09-15  Tadeu Zagallo  <tzagallo@apple.com>
    212
  • trunk/Source/JavaScriptCore/builtins/IteratorHelpers.js

    r257681 r267125  
    3232
    3333    var result = [];
     34    if (@isUndefinedOrNull(iterable))
     35        @throwTypeError('Spread syntax requires ...iterable not be null or undefined');
     36   
     37    var iteratorMethod = iterable.@@iterator;
     38    if (!@isCallable(iteratorMethod))
     39        @throwTypeError('Spread syntax requires ...iterable[Symbol.iterator] to be a function');
    3440
    35     var iterator = iterable.@@iterator();
     41    var iterator = iteratorMethod.@call(iterable);
    3642    var next = iterator.next;
    3743    var item;
Note: See TracChangeset for help on using the changeset viewer.