[Webkit-unassigned] [Bug 182509] New: Error messages for apis that expect iterables are inconsistent

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 5 14:11:38 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=182509

            Bug ID: 182509
           Summary: Error messages for apis that expect iterables are
                    inconsistent
           Product: WebKit
           Version: Safari 11
          Hardware: All
                OS: All
            Status: NEW
          Severity: Enhancement
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: me at michaelghayes.com

`new Set(123)` and `for(const x of 123);` both throw errors because they expect iterables, but the errors they throw are very different and not very informative. 

In the spec these errors are generated when step if https://tc39.github.io/ecma262/#sec-set-iterable is run on a value that does not have an iterator property.
Currently firefox generates error messages that look like: `TypeError: 123 is not iterable` for both of the above cases, which is very intuitive and actionable.

Chrome handles the for-of case the same way, but generates an `undefined is not a function` error for the Set case.  I have filed an issue to make this behavior consistent (https://bugs.chromium.org/p/chromium/issues/detail?id=809214).

In Safari the Set constructor example generates a TypeError with no message, and the for-of loop generates an `undefined is not a function` error.

Ideally the behavior for these 2 examples would be consistent.

-- 
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/20180205/afb20e79/attachment.html>


More information about the webkit-unassigned mailing list