Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1221)

Unified Diff: test/mjsunit/json2.js

Issue 11369004: Correctly handle proxies in JSON.stringify. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/json2.js
diff --git a/test/mjsunit/json2.js b/test/mjsunit/json2.js
index 33e0aecd1e2928994a1cc478b3b7a15f0a3d4cc9..82d48c0dcf76769c53f71f1442a3cd1c25547c8d 100644
--- a/test/mjsunit/json2.js
+++ b/test/mjsunit/json2.js
@@ -109,6 +109,11 @@ assertEquals('["00","11"]', JSON.stringify(tojson_with_key_2));
var tojson_ex = { toJSON: function(key) { throw "123" } };
assertThrows(function() { JSON.stringify(tojson_ex); });
+// Test toJSON with access to this.
+var obj = { toJSON: function(key) { return this.a + key; },
+ a: "x" };
+assertEquals('{"y":"xy"}', JSON.stringify({y: obj}));
+
// Test holes in arrays.
var fast_smi = [1, 2, 3, 4];
fast_smi.__proto__ = [7, 7, 7, 7];
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698