Debian Codegraph @

js/src/tests/test262/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 throw new Test262Error("Expected an exception.");
30 } catch (e) {
31 if (!(e instanceof TypeError)) {
32 throw new Test262Error("Expected TypeError, got " + e);
33 }
34 }
35
36 verifyProperty(arrObj, "1", {
37 value: 3,
38 writable: true,
39 enumerable: false,
40 configurable: false,
41 });
42
43 reportCompare(0, 0);