2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2011 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
|
|
|
info: JSON.parse must create a property with the given property name
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 15.12.2_A1
|
2014-07-22 01:09:02 +02:00
|
|
|
description: Tests that JSON.parse treats "__proto__" as a regular property name
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
|
|
|
var x = JSON.parse('{"__proto__":[]}');
|
|
|
|
if (Object.getPrototypeOf(x) !== Object.prototype) {
|
2015-06-09 18:08:02 +02:00
|
|
|
$ERROR('#1: JSON.parse confused by "__proto__"');
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
if (!Array.isArray(x.__proto__)) {
|
2015-06-09 18:08:02 +02:00
|
|
|
$ERROR('#2: JSON.parse did not set "__proto__" as a regular property');
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|