Closed
Bug 375801
Opened 18 years ago
Closed 18 years ago
uneval should use "(void 0)" instead of "undefined"
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: jruderman, Assigned: crowderbt)
Details
(Keywords: testcase)
Attachments
(1 file, 1 obsolete file)
|
2.99 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
js> uneval({a: undefined})
({a:undefined})
This is wrong because "undefined" is a mutable property of the global object. In bug 351219, Brendan suggested using "(void 0)" instead.
| Assignee | ||
Comment 1•18 years ago
|
||
I wonder if this too should be WONTFIXed. How much of the web would be broken by this change?
| Reporter | ||
Comment 2•18 years ago
|
||
How much of the web even uses uneval? Only SpiderMonkey supports it.
| Assignee | ||
Comment 3•18 years ago
|
||
Well, I think in our case toSource and toString are not so different (especially here). This seems like a risky change, but here is what a patch would look like (I think) if we were to implement it.
Comment 4•18 years ago
|
||
Comment on attachment 267471 [details] [diff] [review]
adds "(void 0)" atom and uses it for toString of JSVAL_VOID
Is it really worth it to add an atom for this? I feel like a static const char[] in jsstr.c would suffice here. Tell me if I'm wrong, though!
| Reporter | ||
Comment 5•18 years ago
|
||
I think toString should return "undefined" for web compatibility and avoiding surprise, but toSource/uneval should return "(void 0)" for correctness.
| Assignee | ||
Comment 6•18 years ago
|
||
Still using an atom here, for now, but I can be convinced otherwise.
Attachment #267471 -
Attachment is obsolete: true
Attachment #267477 -
Flags: review?(mrbkap)
Attachment #267471 -
Flags: review?(mrbkap)
Updated•18 years ago
|
Attachment #267477 -
Flags: review?(mrbkap) → review+
Comment 7•18 years ago
|
||
I can see how using a C string constant and inflating it into a new JS string every time would be both (a) more code than this patch, and (b) costly in time and (if done often) space. Sometimes the smallest patch is the best, yay. Cc'ing Igor to get his thoughts.
/be
| Assignee | ||
Updated•18 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 8•18 years ago
|
||
/cvsroot/mozilla/js/tests/js1_5/extensions/regress-375801.js,v <-- regress-375801.js
initial revision: 1.1
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•