| 1 |
// Copyright 2011 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: JSON.parse must create a property with the given property name |
| 6 |
es5id: 15.12.2_A1 |
| 7 |
description: Tests that JSON.parse treats "__proto__" as a regular property name |
| 8 |
---*/ |
| 9 |
|
| 10 |
var x = JSON.parse('{"__proto__":[]}'); |
| 11 |
if (Object.getPrototypeOf(x) !== Object.prototype) { |
| 12 |
$ERROR('#1: JSON.parse confused by "__proto__"'); |
| 13 |
} |
| 14 |
if (!Array.isArray(x.__proto__)) { |
| 15 |
$ERROR('#2: JSON.parse did not set "__proto__" as a regular property'); |
| 16 |
} |