keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | es5id: 15.2.3.7-6-a-273 |
| 6 | description: > |
| 7 | Object.defineProperties - 'O' is an Array, 'P' is generic own data |
| 8 | property of 'O', test TypeError is thrown when updating the |
| 9 | [[Configurable]] attribute value of 'P' which is defined as |
| 10 | non-configurable (15.4.5.1 step 5) |
| 11 | includes: [propertyHelper.js] |
| 12 | ---*/ |
| 13 | |
| 14 | |
| 15 | var arr = []; |
| 16 | |
| 17 | Object.defineProperty(arr, "property", { |
| 18 | value: 12 |
| 19 | }); |
| 20 | |
| 21 | try { |
| 22 | Object.defineProperties(arr, { |
| 23 | "property": { |
| 24 | configurable: true |
| 25 | } |
| 26 | }); |
| 27 | $ERROR("Expected an exception."); |
| 28 | } catch (e) { |
| 29 | verifyEqualTo(arr, "property", 12); |
| 30 | |
| 31 | verifyNotWritable(arr, "property"); |
| 32 | |
| 33 | verifyNotEnumerable(arr, "property"); |
| 34 | |
| 35 | verifyNotConfigurable(arr, "property"); |
| 36 | |
| 37 | if (!(e instanceof TypeError)) { |
| 38 | $ERROR("Expected TypeError, got " + e); |
| 39 | } |
| 40 | |
| 41 | } |