Closed Bug 633256 Opened 14 years ago Closed 14 years ago

JSON.stringify should convert boolean wrapper objects

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 557371

People

(Reporter: jandem, Unassigned)

References

Details

The IE test site has 81 JSON tests. We fail only 2 of them, tests like this: -- function testcase() { var obj = {prop: 42, toJSON: function () {return new Boolean(true);}}; return JSON.stringify([obj]) === "[true]"; } -- Fix is super easy, will attach a patch in a minute.
See bug 557371, with an attached and reviewed patch. The only problem it encountered on initial landing was some JSON tests outside js/src/ which expected equality of output between native JSON and json2.js, which is not a proper expectation. The fix was non-obvious at the time (I perennially forget that dom/src/json has tests that can fail when json.cpp changes), so I backed out and punted to next release, when I'd have time to fully adjust those tests to be correct.
Thanks, that's even easier :) Marking this as depending on bug 557371 then. Maybe a duplicate, but that bug does not mention the Boolean case, so I'll keep this open.
Depends on: 557371
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.