Bug 157041
| Summary: | The error message for for-of loops without Symbol.iterator is awful. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Keith Miller <keith_miller> |
| Component: | JavaScriptCore | Assignee: | Fady Farag <com.webkit.iidmsa> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | com.webkit.iidmsa, joepeck, saam, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Keith Miller
The error message is possibly one of the worst I have ever seen...
>>> for (a of {}) {}
Exception: TypeError: a of {} is not a function. (In 'a of {}', 'a of {}' is undefined)
I'm not even remotely sure how anyone would be able to debug this without tears.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Joseph Pecoraro
This goes even more bonkers if the left hand side is a variable declaration with destructuring, it seems to include source text outside of the for loop entirely:
>>> /* comment */ for (var {a} of {}) {}
Exception: TypeError: /* comment */ for (var {a} of {} is not a function. (In '/* comment */ for (var {a} of {}', '/* comment */ for (var {a} of {}' is undefined)
Joseph Pecoraro
Heh, this makes me chuckle every time I see it!
Saam Barati
Hah I'll try to fix this tmrw.
Radar WebKit Bug Importer
<rdar://problem/159814766>
Fady Farag
Pull request: https://github.com/WebKit/WebKit/pull/50282
EWS
Committed 300154@main (0051bbf2491f): <https://commits.webkit.org/300154@main>
Reviewed commits have been landed. Closing PR #50282 and removing active labels.