----- Original Message -----
> From: "Chris Peterson" <cpeter...@mozilla.com>
> To: dev-platform@lists.mozilla.org
> Sent: Tuesday, May 6, 2014 3:11:40 PM
> Subject: Re: Disabling strict warnings as errors in xpcshell
> 
> btw, I believe the JS team now uses the term "extra warnings" to
> differentiate SpiderMonkey's non-standard "strict warnings"
> (javascript.options.strict pref) from ES5's "strict mode".
> 
> Does anyone actually want these strict/extra warnings? Can we just
> remove this misfeature from SpiderMonkey?

I find this feature extremely useful. When chrome code contains a typo, without 
extraWarnings we often just produce no error at all. The most common case is 
that Firefox opens to a blank window (i.e., no content is drawn) and no output. 
To solve these bugs, I've had to bisect my own code to find the typo. When it 
turns out to be something as simple as a typo, it's extremely frustrating. The 
extraWarnings option makes it very easy to quickly identify these sorts of bugs.

In addition, I think the |if (obj.quacks)| example may be overly simplified. 
The JS engine is smart enough to recognize this pattern and not warn about it. 
As far as I know, there's no need to change it to |if (obj.quacks || false)|. 
The time you typically need to pull tricks like that is when passing optional 
properties to function, as in |func(foo, bar, obj.quacks)| when quacks may not 
be defined. This seems like bad practice to me though. It's not at all clear to 
the reader that you might not expect the property to be defined.

> These strict/extra warnings are also enabled in Firefox's debug builds
> (javascript.options.strict.debug pref), which can cause Firefox features
> to misbehave differently in debug and release builds.

As far as I know, the warnings never change behavior. They just cause us to 
print warnings.

> Besides the
> `obj.quacks || false` problem, it can also report false positive
> warnings about some functions' unreachable code paths not returning a value.

I agree that the unreachable code warning is pretty useless. I'd be fine 
removing it. The undefined property one is the only useful one that I know of.

-Bill
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to