Fix JSON issue with arrays.

Review URL: http://codereview.chromium.org/7089003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8100 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sandholm@chromium.org 2011-05-30 10:47:38 +00:00
parent 683baa1682
commit ba229754ea
2 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,10 @@ function BasicSerializeArray(value, stack, builder) {
// First entry is a string. Remaining entries are likely to be strings too.
var array_string = %QuoteJSONStringArray(value);
if (!IS_UNDEFINED(array_string)) {
// array_string also includes bracket characters so we are done.
builder[builder.length - 1] = array_string;
stack.pop();
return;
} else {
builder.push(%QuoteJSONString(val));
for (var i = 1; i < len; i++) {

View File

@ -256,6 +256,7 @@ assertEquals("[1,2,[3,[4],5],6,7]",
JSON.stringify([1, 2, [3, [4], 5], 6, 7], null));
assertEquals("[2,4,[6,[8],10],12,14]",
JSON.stringify([1, 2, [3, [4], 5], 6, 7], DoubleNumbers));
assertEquals('["a","ab","abc"]', JSON.stringify(["a","ab","abc"]));
var circular = [1, 2, 3];
circular[2] = circular;