nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js (1143B)
1 // Copyright (C) 2017 Caio Lima. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Mapped arguments property descriptor change to non-configurable, non-enumerable and non-writable 6 info: | 7 Change the descriptor using [[DefineOwnProperty]] to 8 {configurable: false, enumerable: false}, set a = 2 and then 9 change property descriptor to {writable: false}. The descriptor's enumerable 10 property need to be the one set before the mapping removal. 11 flags: [noStrict] 12 esid: sec-arguments-exotic-objects-defineownproperty-p-desc 13 includes: [propertyHelper.js] 14 ---*/ 15 16 function fn(a) { 17 Object.defineProperty(arguments, "0", {configurable: false, enumerable: false}); 18 a = 2; 19 Object.defineProperty(arguments, "0", {writable: false}); 20 21 verifyProperty(arguments, "0", { 22 value: 2, 23 writable: false, 24 enumerable: false, 25 configurable: false, 26 }); 27 28 // Postcondition: Arguments mapping is removed. 29 a = 3; 30 31 verifyProperty(arguments, "0", { 32 value: 2, 33 writable: false, 34 enumerable: false, 35 configurable: false, 36 }); 37 } 38 fn(1); 39 40 41 reportCompare(0, 0);