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

Unified Diff: test/mjsunit/harmony/proxies-json.js

Issue 11363078: Add fast path for FastProperty objects in JSON.stringify. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment. Created 8 years, 1 month 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 | « src/json-stringifier.h ('k') | test/mjsunit/json2.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/proxies-json.js
diff --git a/test/mjsunit/harmony/proxies-json.js b/test/mjsunit/harmony/proxies-json.js
index 0a5be65f3a77abb791d3c52de0d0e0ebf8717d85..539c5a84cb99807416016ea63d0b839b02697e83 100644
--- a/test/mjsunit/harmony/proxies-json.js
+++ b/test/mjsunit/harmony/proxies-json.js
@@ -154,3 +154,25 @@ var proxy6 = Proxy.create(handler6);
testStringify('[1,null,true]', [1, proxy6, true]);
testStringify('{"a":1,"c":true}', {a: 1, b: proxy6, c: true});
+// Object containing a proxy that changes the parent's properties.
+var handler7 = {
+ get: function(target, name) {
+ delete parent7.a;
+ delete parent7.c;
+ parent7.e = "5";
+ return name.toUpperCase();
+ },
+ enumerate: function(target) {
+ return ['a', 'b', 'c'];
+ },
+ getOwnPropertyDescriptor: function(target, name) {
+ return { enumerable: true };
+ }
+}
+
+var proxy7 = Proxy.create(handler7);
+var parent7 = { a: "1", b: proxy7, c: "3", d: "4" };
+assertEquals('{"a":"1","b":{"a":"A","b":"B","c":"C"},"d":"4"}',
+ JSON.stringify(parent7));
+assertEquals('{"b":{"a":"A","b":"B","c":"C"},"d":"4","e":"5"}',
+ JSON.stringify(parent7));
« no previous file with comments | « src/json-stringifier.h ('k') | test/mjsunit/json2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698