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