Open Bug 1040976 Opened 10 years ago Updated 2 years ago

Add an option to enable to extraWarnings flag in the JS engine for a web page

Categories

(DevTools :: General, defect, P3)

x86_64
Linux
defect

Tracking

(Not tracked)

People

(Reporter: billm, Unassigned)

References

(Blocks 1 open bug)

Details

The extraWarnings flag in the JS engine generates warnings when you do things that are legal in JS, but probably errors. The most useful example is accessing properties that don't exist. Right now this option is enabled only for chrome code, and only in debug builds. I think it's really great for tracking down JS bugs.

Pretty soon we'll be able to enable this option on a per-compartment bases (bug 940305). It would be great if devtools exposed a checkbox or something so that developers could get these warnings if they wanted. I think it would be a nice competitive advantage. As a web developer, the lack of these warnings was always my biggest complaint about JS.
Does this mean that content will warn on the following:

    var t = {};
    if (t.foo == null) {
      // do something
    }

That's not too common in moz code, but it's much more common on the web. IIRC it's part of the crockford style guide.
(In reply to Joe Walker [:jwalker] from comment #1)
> Does this mean that content will warn on the following:
> 
>     var t = {};
>     if (t.foo == null) {
>       // do something
>     }
> 
> That's not too common in moz code, but it's much more common on the web.
> IIRC it's part of the crockford style guide.

No, it knows about that pattern and doesn't warn about it.
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.