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