Closed
Bug 604210
Opened 13 years ago
Closed 13 years ago
Referencing property of undefined produces cryptic "(void 0) is undefined" message
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | - |
People
(Reporter: jono, Assigned: luke)
References
Details
(Keywords: regression, testcase, Whiteboard: fixed-in-tracemonkey)
Attachments
(2 files, 1 obsolete file)
494 bytes,
text/html
|
Details | |
2.04 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
This is on Firefox 4.0b6 on Windows 7. Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6) Gecko/20100101 Firefox/4.0b6 Steps to reproduce: The simplest Javascript code I've been able to come up with to reproduce the message is as follows: let undefObj = undefined; dump(undefObj.foo); This produces an error in the javascript error console saying: (void 0) is undefined Expected behavior: A more informative error message such as "undefObj is undefined" would make debugging a lot easier.
FWIW, it only happens in function context -- I get the right result in global context.
Any chance of finding a regression range here, Jono? *bats eyelashes*
blocking2.0: --- → ?
Keywords: regression,
regressionwindow-wanted
Comment 3•13 years ago
|
||
The first bad revision is: changeset: b16d966d3b6f user: Luke Wagner date: Fri Jul 30 14:49:29 2010 -0700 summary: Bug 579183 - loosen-up StackSegment invariants - part 1 - decompiler (r=brendan)
Blocks: 579183
Keywords: regressionwindow-wanted → testcase
Comment 4•13 years ago
|
||
Before that patch, the error message was the expected "undefObj is undefined".
![]() |
Assignee | |
Comment 5•13 years ago
|
||
The issue in the examples is that JSOP_GETLOCALPROP is reporting an error for a value that is above the simulated stack depth (the one pushed by JSOP_GETLOCALPROP before jumping into JSOP_GETPROP). The search done by JSDVG_SEARCH_STACK starts at regs.sp and finds a match, but can't use the pc from pcstack because sp is above said simulated depth. Before the fingered patch, this would fall into the case of "just decompile the current pc" (which gives pretty results). After the patch, it causes us to fall back to the "just print the value" case (which gives (void 0)). The attached patch just undoes the last part of (https://bugzilla.mozilla.org/attachment.cgi?id=460220&action=diff), which, I see now, wasn't necessary.
![]() |
Assignee | |
Comment 6•13 years ago
|
||
Oops, forgot the fixins.
Attachment #483409 -
Attachment is obsolete: true
Attachment #483410 -
Flags: review?(brendan)
Attachment #483409 -
Flags: review?(brendan)
Comment 7•13 years ago
|
||
> its usually what we want
It's
Comment 8•13 years ago
|
||
The comment makes me think this code could use additional tests, maybe even including a currently-failing test.
![]() |
Assignee | |
Comment 9•13 years ago
|
||
I think it has long been understood that JSDVG_SEARCH_STACK was only a heuristic and by no means always gives the right error message. For one, its searching for a match on the stack *by value*.
![]() |
Assignee | |
Comment 10•13 years ago
|
||
But, for example, one of the "contrived" cases I was referring to (which, incidentally, gives the wrong message before and after b16d966d3b6f) is Array.prototype.sort.call([1,2], {}); which prints test.js:1: TypeError: Array.prototype.sort.call([1, 2], {}) is not a function
Comment 11•13 years ago
|
||
Comment on attachment 483410 [details] [diff] [review] fix, test, comment Jesse nitted "its" and I will nit "anyways" -- "anyway". Maybe a comma would help, too. The last sentence starting with "If above" does run on. /be
Attachment #483410 -
Flags: review?(brendan) → review+
Comment 12•13 years ago
|
||
JSDVG_SEARCH_STACK is cheese from old days. We should try to get rid of it but not with lame blame. We should propagate more precise spindex or whatever the right blame cursor is (it might be quite abstract, to cover properties too). /be
Updated•13 years ago
|
blocking2.0: ? → -
![]() |
Assignee | |
Comment 13•13 years ago
|
||
Thanks; the comments reflected the hour in which they were written ;-) http://hg.mozilla.org/tracemonkey/rev/d395cc77e0aa
Whiteboard: fixed-in-tracemonkey
Comment 14•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/d395cc77e0aa
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•