deno.land / std@0.224.0 / jsonc / testdata / test262 / JSON / parse / duplicate-proto.js

duplicate-proto.js
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// Copyright (C) 2020 devsnek. All rights reserved.// This code is governed by the BSD license found in the LICENSE file.
/*---esid: sec-object-initializer-static-semantics-early-errorsdescription: > It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains any duplicate entries for "__proto__" and at least two of those entries were obtained from productions of the form PropertyDefinition : PropertyName `:` AssignmentExpression . This rule is not applied if this PropertyDefinition is contained within a Script which is being evaluated for JSON.parse (see step 4 of JSON.parse).---*/
var result = JSON.parse('{ "__proto__": 1, "__proto__": 2 }');
assert.sameValue(result.__proto__, 2);
std

Version Info

Tagged at
4 months ago