[Webkit-unassigned] [Bug 215974] Wrong error message of the spread.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Sep 14 11:47:27 PDT 2020
https://bugs.webkit.org/show_bug.cgi?id=215974
--- Comment #12 from Alexey Shvayka <shvaikalesh at gmail.com> ---
Comment on attachment 408724
--> https://bugs.webkit.org/attachment.cgi?id=408724
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=408724&action=review
> Source/JavaScriptCore/builtins/IteratorHelpers.js:35
> + if (@isUndefinedOrNull(iterable) || @isUndefinedOrNull(iterable.@@iterator))
Please note that Get(iterable, @@iterator) is performed twice.
It is observable if `iterable` is a Proxy or @@iterator is a getter.
> Source/JavaScriptCore/builtins/IteratorHelpers.js:36
> + @throwTypeError(`${iterable} is not iterable`);
Please note we are calling ToString on (likely) non-primitive, which is also observable.
The spec (https://tc39.es/ecma262/#sec-getiterator) doesn't have such call.
Instead, let's do this:
```
if (@isUndefinedOrNull(iterable))
@throwTypeError("Spread syntax requires ...iterable not be null or undefined");
var iteratorMethod = iterable.@@iterator;
if (!@isCallable(iteratorMethod))
@throwTypeError("Spread syntax requires ...iterable[Symbol.iterator] to be a function");
var iterator = iteratorMethod. at call(iterable);
```
Error messages I am suggesting are similar to ones we have in Source/JavaScriptCore/builtins/ArrayConstructor.js/from.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200914/c285467d/attachment-0001.htm>
More information about the webkit-unassigned
mailing list