Revision: 5051
Author: [email protected]
Date: Tue Jul 13 03:57:45 2010
Log: Fix JSON.parse typo which causes the input not to be string converted.

Review URL: http://codereview.chromium.org/2981004
http://code.google.com/p/v8/source/detail?r=5051

Modified:
 /branches/bleeding_edge/src/json.js
 /branches/bleeding_edge/test/mjsunit/json.js

=======================================
--- /branches/bleeding_edge/src/json.js Tue Jun 29 00:22:40 2010
+++ /branches/bleeding_edge/src/json.js Tue Jul 13 03:57:45 2010
@@ -29,7 +29,7 @@

 function ParseJSONUnfiltered(text) {
   var s = $String(text);
-  var f = %CompileString(text, true);
+  var f = %CompileString(s, true);
   return f();
 }

=======================================
--- /branches/bleeding_edge/test/mjsunit/json.js        Wed Feb  3 05:29:42 2010
+++ /branches/bleeding_edge/test/mjsunit/json.js        Tue Jul 13 03:57:45 2010
@@ -85,7 +85,7 @@
 };
 assertEquals(null, n4.toJSON());

-assertEquals(Object.prototype, JSON.__proto__);
+assertTrue(Object.prototype === JSON.__proto__);
 assertEquals("[object JSON]", Object.prototype.toString.call(JSON));

 // DontEnum
@@ -313,3 +313,7 @@
 var x = 0;
 eval("(1); x++; (1)");
 TestInvalid('1); x++; (1');
+
+// Test string conversion of argument.
+var o = { toString: function() { return "42"; } };
+assertEquals(42, JSON.parse(o));

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to