Closed Bug 705795 Opened 13 years ago Closed 5 years ago

better control of js warning in strict.

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1619177

People

(Reporter: irakli, Unassigned)

References

Details

In jetpack we set 'javascript.options.strict' pref to 'true' when running tests / debugging to identify code that is poorly written, or prone to cause logic errors. Arguably "reference to undefined property" warnings are useless, they prevent us from using: 1. Destructuring assignments: Instead of writing: let { a, b } = object; if (a && b) // ... we end up with let a = a in object && object.a; let b = b in object && object.b; if (a && b) // ... 2. Concise property comparison: if (a.foo === b.foo) // ... we end up with if ('foo' in a ? ('foo' in b && foo.a === foo.b) || !b.foo : !('foo' in b)) //.. It would be very helpful to have more granular control of strict warnings for example a pref to disable / enable 'reference to undefined property' warnings.
Core::Jemalloc is definitely not the right place for this.
Assignee: nobody → general
Component: jemalloc → JavaScript Engine
QA Contact: jemalloc → general
Blocks: 697775
I particularly notice this when using destructuring assignment as a poor man's named parameters: > function foo({ bar }) {}; foo({}); Warning: reference to undefined property "bar" Source file: javascript:%20function%20foo({%20bar%20})%20{};%20foo({}); Line: 1 I would rather not be warned in these cases, especially since I can't distinguish between optional and required parameters (although if I could, then I'd want the JS engine to generate an exception rather than a warning if a required one was missing).
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.