tests with empty body should cause a JS strict warning

RESOLVED FIXED in mozilla11

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: florian, Assigned: cdleary)

Tracking

Trunk
mozilla11
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
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).
Created attachment 580978 [details] [diff] [review]
Corresponding warning.

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)
Created attachment 580984 [details] [diff] [review]
Corresponding warning.

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+
https://hg.mozilla.org/integration/mozilla-inbound/rev/ac2e9f57426d

Florian, thanks for the good idea!
Target Milestone: --- → mozilla11
(Reporter)

Comment 5

5 years ago
(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. :-)
https://hg.mozilla.org/mozilla-central/rev/ac2e9f57426d
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.