nonwritable-nonconfigurable-descriptors-set-by-arguments.js (1232B)
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. Change the 8 descriptor using [[DefineOwnProperty]] to {writable: false}, set argument[0] = 2 and then 9 change property descriptor to {configurable: false}. 10 The descriptor's value is the one set before the property be 11 configured as {writable: false} because mapping was removed. 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 arguments[0] = 2; 20 Object.defineProperty(arguments, "0", {configurable: false}); 21 22 assert.sameValue(a, 1); 23 24 verifyProperty(arguments, "0", { 25 value: 1, 26 writable: false, 27 enumerable: true, 28 configurable: false, 29 }); 30 31 // Postcondition: Arguments mapping is removed. 32 a = 3; 33 34 verifyProperty(arguments, "0", { 35 value: 1, 36 writable: false, 37 enumerable: true, 38 configurable: false, 39 }); 40 } 41 fn(1); 42 43 44 reportCompare(0, 0);