Index: test/mjsunit/json2.js |
diff --git a/test/mjsunit/json2.js b/test/mjsunit/json2.js |
index 33e0aecd1e2928994a1cc478b3b7a15f0a3d4cc9..82ff572e009eb6567e68b1dff10c2e77a74e7c2b 100644 |
--- a/test/mjsunit/json2.js |
+++ b/test/mjsunit/json2.js |
@@ -109,6 +109,10 @@ 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]; |