OLD | NEW |
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // objects in JSON.parse. Instead we read them as we would JS object | 421 // objects in JSON.parse. Instead we read them as we would JS object |
422 // literals. If we change that, this test should change with it. | 422 // literals. If we change that, this test should change with it. |
423 // | 423 // |
424 // Parse a non-object value as __proto__. This must not create a | 424 // Parse a non-object value as __proto__. This must not create a |
425 // __proto__ property different from the original, and should not | 425 // __proto__ property different from the original, and should not |
426 // change the original. | 426 // change the original. |
427 var o = JSON.parse('{"__proto__":5}'); | 427 var o = JSON.parse('{"__proto__":5}'); |
428 assertEquals(Object.prototype, o.__proto__); // __proto__ isn't changed. | 428 assertEquals(Object.prototype, o.__proto__); // __proto__ isn't changed. |
429 assertEquals(0, Object.keys(o).length); // __proto__ isn't added as enumerable. | 429 assertEquals(0, Object.keys(o).length); // __proto__ isn't added as enumerable. |
430 | 430 |
431 | 431 var json = '{"stuff before slash\\\\stuff after slash":"whatever"}'; |
432 | 432 assertEquals(json, JSON.stringify(JSON.parse(json))); |
OLD | NEW |