Closed
Bug 306738
Opened 20 years ago
Closed 20 years ago
uneval() on an object with getter or setter has unmatched parenthesis
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: ldavismead, Assigned: mrbkap)
References
()
Details
(Keywords: js1.5, testcase, verified1.8)
Attachments
(1 file)
1.43 KB,
patch
|
brendan
:
review+
brendan
:
approval1.8b4+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20050901 SeaMonkey/1.1a
Doing something like
uneval(
{
get foo()
{
return "foo";
}
});
gives ({get foo(){return "foo";})}) as its output, which has a mismatched
parenthesis. Unevaling a function results in (function(){}), so I suspect that
the getter/setter uneval code is delegating to the function uneval code,
stripping the leading "(" and then failing to strip the trailing ")". Eval only
understands ({get foo(){return "foo";}}): I can't stick an extra set of parens
around the getter in any way.
Reproducible: Always
Steps to Reproduce:
Click on the testcase URL.
Actual Results:
({get foo(){return "foo";})}) is alerted.
Expected Results:
({get foo(){return "foo";}}) should be alerted.
Also occurs in:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Also occurs when using a setter, or when getters or setters have been added
using the (not-so) super-secret __define{S,G}etter__ object methods.
Reporter | ||
Updated•20 years ago
|
Component: General → JavaScript Engine
Product: Mozilla Application Suite → Core
Version: unspecified → Trunk
Reporter | ||
Comment 1•20 years ago
|
||
Whoops. I got confused by the shiny new bug wizard and filed this under general
browser instead of core javascript (I missed "other" on the main page). Sorry
for the spam.
Keywords: testcase
Reporter | ||
Updated•20 years ago
|
QA Contact: general → general
Updated•20 years ago
|
Assignee: general → general
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: general → general
Assignee | ||
Comment 2•20 years ago
|
||
I have a newfound liking of the decompiler. I'll take this.
Assignee: general → mrbkap
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•20 years ago
|
||
The problem was that js_obj_toSource wasn't accounting for the parentheses at
all. This patch makes it do that (and removes the spurious space between the
getter name and the opening parameter parenthesis.
Attachment #194608 -
Flags: review?(brendan)
Comment 4•20 years ago
|
||
Comment on attachment 194608 [details] [diff] [review]
Account for parentheses
Beef that comment up to avoid the window/orphan as discussed!
/be
Attachment #194608 -
Flags: review?(brendan)
Attachment #194608 -
Flags: review+
Attachment #194608 -
Flags: approval1.8b4+
Assignee | ||
Comment 5•20 years ago
|
||
Fix checked into MOZILLA_1_8_BRANCH and trunk.
Comment 6•20 years ago
|
||
Checking in regress-306738.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-306738.js,v <-- regress-306738.js
initial revision: 1.1
done
Flags: testcase+
Comment 7•19 years ago
|
||
verified fixed 1.8.x and trunk.
Status: RESOLVED → VERIFIED
Keywords: fixed1.8 → verified1.8
You need to log in
before you can comment on or make changes to this bug.
Description
•