nonconfigurable-nonwritable-descriptors-set-by-arguments.js (1217B)
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 and non-writable 6 info: | 7 Mapping just stop working when property is set to non-writable. Change the 8 descriptor using [[DefineOwnProperty]] to {configurable: false}, set arguments[0] = 2 9 and then change property descriptor to {writable: false}. 10 The descriptor's value 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", {configurable: false}); 19 arguments[0] = 2; 20 Object.defineProperty(arguments, "0", {writable: false}); 21 22 assert.sameValue(a, 2) 23 24 verifyProperty(arguments, "0", { 25 value: 2, 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: 2, 36 writable: false, 37 enumerable: true, 38 configurable: false, 39 }); 40 } 41 fn(1); 42 43 44 reportCompare(0, 0);