Wrong message for TypeError
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: _, Assigned: arai)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0
Steps to reproduce:
I executed:
a = {}
b = {}
a.c.d = b.e
Tested on 74.0a1 (2020-01-27) (64-bit) on Fedora 31.
Actual results:
I got the error: TypeError: can't access property "d", b.e is undefined
Expected results:
I expect the error: TypeError: can't access property "d", a.c is undefined
Another example, which gives an expected error message is:
a = {}
b = {}
a.c.d = ""
It gives the error message: TypeError: can't access property "d", a.c is undefined
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
This is caused by the confusion between 2 undefined
values on the stack, while decompiling the value for error report.
in the example code, b.e
is also undefined
and is top of the stack, so DecompileValueGenerator
finds it and returns decompiled string for it.
we might be able to specify where to search in the stack, depending on the current operation.
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/fc5a0b479615 Specify the stack index for decompilation when reporting null or undefined property access. r=jwalden
Comment 5•4 years ago
|
||
bugherder |
Description
•