Closed
Bug 1437377
Opened 8 years ago
Closed 7 years ago
Use dedicated error message when using "in" operator on non-string/non-object
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla60
| Tracking | Status | |
|---|---|---|
| firefox60 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
|
3.54 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
The error message for `string in string` case is improved in bug 1352429,
but now it's a bit mis-leading for `string in undefined` or `string in null` case,
that should happen more in practice.
we should use more descriptive message for those cases.
Updated•7 years ago
|
Priority: -- → P3
| Assignee | ||
Updated•7 years ago
|
Keywords: dev-doc-needed
| Assignee | ||
Updated•7 years ago
|
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•7 years ago
|
||
non-string/non-object cases:
js> "foo" in undefined
typein:1:1 TypeError: right-hand side of 'in' should be an object, got undefined
js> "foo" in null
typein:2:1 TypeError: right-hand side of 'in' should be an object, got null
js> "foo" in 10
typein:3:1 TypeError: right-hand side of 'in' should be an object, got number
js> "foo" in true
typein:4:1 TypeError: right-hand side of 'in' should be an object, got boolean
js> "foo" in Symbol.iterator
typein:5:1 TypeError: right-hand side of 'in' should be an object, got symbol
string case:
js> "foo" in "bar"
typein:6:1 TypeError: cannot use 'in' operator to search for 'foo' in 'bar'
Attachment #8952940 -
Flags: review?(jwalden+bmo)
Updated•7 years ago
|
Attachment #8952940 -
Flags: review?(jwalden+bmo) → review+
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ca314f76eb1c
Use dedicated error message when using "in" operator on non-string/non-object. r=jwalden
| Assignee | ||
Comment 3•7 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ca314f76eb1cea65c3999a42960d57ef0eb3e78f
Bug 1437377 - Use dedicated error message when using "in" operator on non-string/non-object. r=jwalden
Comment 4•7 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Comment 5•7 years ago
|
||
Updated https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/in_operator_no_object to talk about the new messages.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•