Upgrade to V8 3.4
Merge 3.4.14.35
Simple merge required updates to makefiles only.
Bug: 568872
Change-Id: I403a38452c547e06fcfa951c12eca12a1bc40978
diff --git a/test/mjsunit/json.js b/test/mjsunit/json.js
index 812ffeb..bead376 100644
--- a/test/mjsunit/json.js
+++ b/test/mjsunit/json.js
@@ -67,7 +67,7 @@
valueOf: "not callable",
toString: "not callable either",
toISOString: function() { return 42; }};
-assertThrows("d4.toJSON()", TypeError); // ToPrimitive throws.
+assertThrows("d4.toJSON()", TypeError); // ToPrimitive throws.
var d5 = {toJSON: Date.prototype.toJSON,
valueOf: "not callable",
@@ -196,9 +196,6 @@
TestInvalid('"Unterminated string\\"');
TestInvalid('"Unterminated string\\\\\\"');
-// JavaScript RegExp literals not valid in JSON.
-TestInvalid('/true/');
-
// Test bad JSON that would be good JavaScript (ES5).
TestInvalid("{true:42}");
TestInvalid("{false:42}");
@@ -259,6 +256,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;
@@ -382,7 +380,7 @@
reJSON.toJSON = function() { return "has toJSON"; };
assertEquals(
- '[37,null,1,"foo","37","true",null,"has toJSON",null,"has toJSON"]',
+ '[37,null,1,"foo","37","true",null,"has toJSON",{},"has toJSON"]',
JSON.stringify([num37, numFoo, numTrue,
strFoo, str37, strTrue,
func, funcJSON, re, reJSON]));
@@ -397,6 +395,9 @@
var counter = { get toJSON() { getCount++;
return function() { callCount++;
return 42; }; } };
+
+// RegExps are not callable, so they are stringified as objects.
+assertEquals('{}', JSON.stringify(/regexp/));
assertEquals('42', JSON.stringify(counter));
assertEquals(1, getCount);
assertEquals(1, callCount);
@@ -419,9 +420,9 @@
// We don't currently allow plain properties called __proto__ in JSON
// objects in JSON.parse. Instead we read them as we would JS object
// literals. If we change that, this test should change with it.
-//
-// Parse a non-object value as __proto__. This must not create a
-// __proto__ property different from the original, and should not
+//
+// Parse a non-object value as __proto__. This must not create a
+// __proto__ property different from the original, and should not
// change the original.
var o = JSON.parse('{"__proto__":5}');
assertEquals(Object.prototype, o.__proto__); // __proto__ isn't changed.