WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
157041
The error message for for-of loops without Symbol.iterator is awful.
https://bugs.webkit.org/show_bug.cgi?id=157041
Summary
The error message for for-of loops without Symbol.iterator is awful.
Keith Miller
Reported
2016-04-26 13:44:03 PDT
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
Comment 1
2016-05-10 15:12:38 PDT
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
Comment 2
2016-10-13 20:27:07 PDT
Heh, this makes me chuckle every time I see it!
Saam Barati
Comment 3
2016-10-18 02:40:59 PDT
Hah I'll try to fix this tmrw.
Radar WebKit Bug Importer
Comment 4
2025-09-03 20:13:38 PDT
<
rdar://problem/159814766
>
Fady Farag
Comment 5
2025-09-03 20:26:25 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/50282
EWS
Comment 6
2025-09-18 06:18:12 PDT
Committed
300154@main
(0051bbf2491f): <
https://commits.webkit.org/300154@main
> Reviewed commits have been landed. Closing PR #50282 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug