Closed
Bug 1322954
Opened 9 years ago
Closed 9 years ago
Fix unsafe `instanceof` negations
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla53
| Tracking | Status | |
|---|---|---|
| firefox53 | --- | fixed |
People
(Reporter: lina, Assigned: lina)
Details
Attachments
(2 files)
Some of our modules use the pattern `!value instanceof Class`, to check if `value` is not an instance of `Class`.
This isn't quite right: `!` binds tighter than `instanceof`, so that will evaluate to `false instanceof Class`...which will always be false (https://github.com/DavidBruant/ECMAScript-regrets/issues/27).
We need an extra set of parens to make this work: `!(value instanceof Class)`.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 4•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8817932 [details]
Bug 1322954 - Fix incorrect `instanceof` negations.
https://reviewboard.mozilla.org/r/98100/#review98410
wow - it's scary how often we weren't checking what we thought we were checking!
Attachment #8817932 -
Flags: review?(markh) → review+
Comment 5•9 years ago
|
||
| mozreview-review | ||
Comment on attachment 8817933 [details]
Bug 1322954 - Replace deprecated `no-negated-in-lhs` ESLint option with `no-unsafe-negation`.
https://reviewboard.mozilla.org/r/98102/#review98412
This looks great, but will require another try.
Attachment #8817933 -
Flags: review?(markh) → review+
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Pushed by kcambridge@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4d6f11e28343
Fix incorrect `instanceof` negations. r=markh
https://hg.mozilla.org/integration/autoland/rev/2c1d9731a014
Replace deprecated `no-negated-in-lhs` ESLint option with `no-unsafe-negation`. r=markh
Comment 9•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/4d6f11e28343
https://hg.mozilla.org/mozilla-central/rev/2c1d9731a014
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in
before you can comment on or make changes to this bug.
Description
•