summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/JSON/parse/S15.12.2_A1.js
blob: 2de3caa3c943e53844981cd45ae59b7a22765e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2011 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: JSON.parse must create a property with the given property name
es5id: 15.12.2_A1
description: Tests that JSON.parse treats "__proto__" as a regular property name
---*/

var x = JSON.parse('{"__proto__":[]}');

assert.sameValue(
  Object.getPrototypeOf(x),
  Object.prototype,
  'Object.getPrototypeOf("JSON.parse(\'{"__proto__":[]}\')") returns Object.prototype'
);

assert(Array.isArray(x.__proto__), 'Array.isArray(x.__proto__) must return true');

reportCompare(0, 0);