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

Side by Side Diff: test/mjsunit/json.js

Issue 1515133002: [proxies] Support proxies in JSON.parse and JSON.stringify. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 var o2 = JSON.parse('{"__proto__":5}'); 482 var o2 = JSON.parse('{"__proto__":5}');
483 assertEquals(5, o2.__proto__); 483 assertEquals(5, o2.__proto__);
484 assertEquals(["__proto__"], Object.keys(o2)); 484 assertEquals(["__proto__"], Object.keys(o2));
485 assertEquals(5, Object.getOwnPropertyDescriptor(o2, "__proto__").value); 485 assertEquals(5, Object.getOwnPropertyDescriptor(o2, "__proto__").value);
486 assertEquals(["__proto__"], Object.getOwnPropertyNames(o2)); 486 assertEquals(["__proto__"], Object.getOwnPropertyNames(o2));
487 assertTrue(o2.hasOwnProperty("__proto__")); 487 assertTrue(o2.hasOwnProperty("__proto__"));
488 assertTrue(Object.prototype.isPrototypeOf(o2)); 488 assertTrue(Object.prototype.isPrototypeOf(o2));
489 489
490 var json = '{"stuff before slash\\\\stuff after slash":"whatever"}'; 490 var json = '{"stuff before slash\\\\stuff after slash":"whatever"}';
491 TestStringify(json, JSON.parse(json)); 491 TestStringify(json, JSON.parse(json));
492
493
494 // https://bugs.chromium.org/p/v8/issues/detail?id=3139
495
496 reviver = function(p, v) {
497 if (p == "a") {
498 this.b = { get x() {return null}, set x(_){throw 666} }
499 }
500 return v;
501 }
502 assertEquals({a: 0, b: {x: null}}, JSON.parse('{"a":0,"b":1}', reviver));
503
504
505 // Make sure a failed [[Delete]] doesn't throw
506
507 reviver = function(p, v) {
508 Object.freeze(this);
509 return p === "" ? v : undefined;
510 }
511 assertEquals({a: 0, b: 1}, JSON.parse('{"a":0,"b":1}', reviver));
512
513
514 // Make sure a failed [[DefineProperty]] doesn't throw
515
516 reviver = function(p, v) {
517 Object.freeze(this);
518 return p === "" ? v : 42;
519 }
520 assertEquals({a: 0, b: 1}, JSON.parse('{"a":0,"b":1}', reviver));
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698