nonconfigurable-nonwritable-descriptors-define-property-consecutive.js (1072B)
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 with non-configurable and non-writable property 6 info: | 7 Mapping stop working when property is set to non-writable. Change the 8 descriptor with two [[DefineOwnProperty]] calls. The descriptor's value need to be 9 the one set before the property be configured as writable: false. 10 flags: [noStrict] 11 esid: sec-arguments-exotic-objects-defineownproperty-p-desc 12 includes: [propertyHelper.js] 13 ---*/ 14 15 function fn(a) { 16 Object.defineProperty(arguments, "0", {configurable: false}); 17 Object.defineProperty(arguments, "0", {writable: false}); 18 19 verifyProperty(arguments, "0", { 20 value: 1, 21 writable: false, 22 enumerable: true, 23 configurable: false, 24 }); 25 26 // Postcondition: Arguments mapping is removed. 27 a = 2; 28 29 verifyProperty(arguments, "0", { 30 value: 1, 31 writable: false, 32 enumerable: true, 33 configurable: false, 34 }); 35 } 36 fn(1); 37 38 39 reportCompare(0, 0);