Closed Bug 709622 Opened 13 years ago Closed 13 years ago

tests with empty body should cause a JS strict warning

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: florian, Assigned: cdleary)

Details

Attachments

(1 file, 1 obsolete file)

I just wasted time today for the second time debugging a code that mysteriously didn't work because of a trailing semi-colon after a test: if (<test>); <code>; <code> is unconditionally executed. I think this code should cause a JS strict warning to appear in my error console and in my terminal (I use a debug build).
Attached patch Corresponding warning. (obsolete) — Splinter Review
Waldo, have you noticed that we do work to detect warning situations even when warnings are disabled? /me wonders how much we can win by not doing that.
Assignee: general → christopher.leary
Status: NEW → ASSIGNED
Attachment #580978 - Flags: review?(jwalden+bmo)
Update: I hooked a test into an existing strict warning test.
Attachment #580978 - Attachment is obsolete: true
Attachment #580978 - Flags: review?(jwalden+bmo)
Attachment #580984 - Flags: review?(jwalden+bmo)
Comment on attachment 580984 [details] [diff] [review] Corresponding warning. Review of attachment 580984 [details] [diff] [review]: ----------------------------------------------------------------- Nice. And yeah, I kind of do wonder about warnings, although I doubt it matters much usually.
Attachment #580984 - Flags: review?(jwalden+bmo) → review+
Target Milestone: --- → mozilla11
(In reply to Chris Leary [:cdleary] from comment #4) > Florian, thanks for the good idea! Thanks for acting on it so quickly! I didn't expect such a fast turnaround on a small detail like this. Now I just wish I filed this bug the first time I wasted time on such a bug instead of adding on my todo list over a year ago that I should do it someday ;).
It's definitely a crapshoot -- some ideas are easier than others and some days the most relevant developers are more highly caffeinated than others. :-)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: