Function.prototype.toString generates invalid javascript code

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
15 years ago
5 years ago

People

(Reporter: sjoerd, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

quoted identifiers are converted to regular identifiers, resulting in invalid code


Reproducible: Always
Steps to Reproduce:
function () { var x = {"a b": 1}; x["this"] = 2; }.toString()
Actual Results:  
function () { var x = {a b:1}; x.this = 2; } 

Expected Results:  
function () { var x = {"a b": 1}; x["this"] = 2; }

There are acutally 2 bugs: 
- quotes around keys in object literals are always removed.
i.e. {"a b":1} becomes {a b:1}
- quotes around keys in lookups are only removed when the result is valid
syntax, except it doesn't test for keywords
i.e. x["a b"] stays x["a b"], but x["this"] becomes x.this, which is invalid
This has been fixed since 1.6.  Please find the original bug and mark this
duplicate.
Whiteboard: DUPEME
Please test something more recent. This was fixed over two months ago.

/be
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → WORKSFORME
Oh, I see -- fx0.8 didn't pick up the 0.6 fix.  Branching early is one thing,
perhaps worth doing for fx-specific reasons, but not tracking 1.6 back-end
changes is a problem.

This is a tardy dup of bug 231518.

/be

Updated

5 years ago
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.