Closed
Bug 346902
Opened 19 years ago
Closed 19 years ago
Incorrect uneval involving an expression that optimized to an object literal
Categories
(Core :: JavaScript Engine, defect, P2)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1
People
(Reporter: jruderman, Assigned: brendan)
References
Details
(Keywords: testcase, verified1.8.1, Whiteboard: [181approval pending])
Attachments
(1 file, 1 obsolete file)
3.22 KB,
patch
|
mrbkap
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
http://www.squarefree.com/shell/shell.html, Mac trunk nightly
> function() { 1 ? {} : 0, alert(3) }
function () { {}, alert(3); }
> function () { {}, alert(3); }
syntax error
I'd expect uneval to either put parentheses around the object literal, or optimize it away altogether, leaving only alert(3) in the function.
Assignee | ||
Updated•19 years ago
|
Assignee: general → brendan
OS: Mac OS X 10.4 → All
Priority: -- → P4
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.9beta
Reporter | ||
Comment 1•19 years ago
|
||
Is this the same bug or something I should file separately?
> function() { 1 ? {}[alert(5)] : 0 }
function () { {}[alert(5)]; }
> function () { {}[alert(5)]; }
function () { [alert(5)]; }
Assignee | ||
Comment 2•19 years ago
|
||
(In reply to comment #1)
> Is this the same bug or something I should file separately?
>
> > function() { 1 ? {}[alert(5)] : 0 }
> function () { {}[alert(5)]; }
This is the bug.
> > function () { {}[alert(5)]; }
> function () { [alert(5)]; }
This is fine -- the empty block has been culled.
/be
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•19 years ago
|
||
This one seems worth fixing for 1.8.1.
/be
Target Milestone: mozilla1.9beta → mozilla1.8.1
Assignee | ||
Comment 5•19 years ago
|
||
mrbkap had a neat alterna-patch that used the operator precedence magic coded in jsopcode.tbl, but I think it ran into a contradiction: it wanted
prec(ENDINIT) < prec(POP) && prec(POP) < prec(ASSIGN)
but to avoid extra parenthesization for x = {p: 2}, we want
prec(ASSIGN) < prec(ENDINIT)
which makes a cycle in the order chain.
So my patch uses brute force in the constant folder.
/be
Attachment #234282 -
Flags: review?(mrbkap)
Comment 6•19 years ago
|
||
Comment on attachment 234282 [details] [diff] [review]
one possible fix
>+ if (pn->pn_type == TOK_RP)
>+ return pn->pn_type == TOK_LP;
This can't be what you wanted.
Assignee | ||
Comment 7•19 years ago
|
||
Attachment #234282 -
Attachment is obsolete: true
Attachment #234292 -
Flags: review?(mrbkap)
Attachment #234282 -
Flags: review?(mrbkap)
Updated•19 years ago
|
Attachment #234292 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 8•19 years ago
|
||
Comment on attachment 234292 [details] [diff] [review]
oops, corrected copy/paste bug
Another safe fix for uneval | eval round-tripping.
/be
Attachment #234292 -
Flags: approval1.8.1?
Assignee | ||
Comment 9•19 years ago
|
||
Fixed on the trunk.
/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 10•19 years ago
|
||
Checking in regress-346902.js;
/cvsroot/mozilla/js/tests/js1_5/Expressions/regress-346902.js,v <-- regress-346902.js
initial revision: 1.1
Flags: in-testsuite+
Comment 11•19 years ago
|
||
verified fixed 1.9 20060818 windows/mac(ppc|tel)/linux
Status: RESOLVED → VERIFIED
Updated•19 years ago
|
Whiteboard: [181approval pending]
Comment 12•19 years ago
|
||
Comment on attachment 234292 [details] [diff] [review]
oops, corrected copy/paste bug
a=schrep for drivers - approving all [181approval pending] bugs now that the tree is open.
Attachment #234292 -
Flags: approval1.8.1? → approval1.8.1+
Comment 14•19 years ago
|
||
verified fixed 1.8, 1.9 20060824 windows/mac*/linux
Keywords: fixed1.8.1 → verified1.8.1
Comment 15•19 years ago
|
||
Checking in regress-346902.js;
/cvsroot/mozilla/js/tests/js1_5/Expressions/regress-346902.js,v <-- regress-346902.js
new revision: 1.2; previous revision: 1.1
done
You need to log in
before you can comment on or make changes to this bug.
Description
•