Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-238.js

raw
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.6-4-238
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 named property, TypeError is thrown if the [[Configurable]]
9 attribute value of 'name' is false and the [[Configurable]] field
10 of 'desc' is true (15.4.5.1 step 4.c)
11 includes: [propertyHelper.js]
12 ---*/
13
14
15 var arrObj = [];
16
17 Object.defineProperty(arrObj, "1", {
18 value: 3,
19 writable: true,
20 configurable: false
21 });
22
23 try {
24 Object.defineProperty(arrObj, "1", {
25 value: 13,
26 writable: true,
27 configurable: true
28 });
29 $ERROR("Expected an exception.");
30
31 } catch (e) {
32 verifyEqualTo(arrObj, "1", 3);
33
34 verifyWritable(arrObj, "1");
35
36 verifyNotEnumerable(arrObj, "1");
37
38 verifyNotConfigurable(arrObj, "1");
39
40 if (!(e instanceof TypeError)) {
41 $ERROR("Expected TypeError, got " + e);
42 }
43
44 }