Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-239.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-239
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 [[Enumerable]] of 'desc'
10 is present and its value is different from the [[Enumerable]]
11 attribute value of 'name' (15.4.5.1 step 4.c)
12 includes: [propertyHelper.js]
13 ---*/
14
15
16 var arrObj = [];
17
18 Object.defineProperty(arrObj, "1", {
19 value: 3,
20 writable: true,
21 configurable: false,
22 enumerable: false
23 });
24
25 try {
26 Object.defineProperty(arrObj, "1", {
27 value: 13,
28 writable: true,
29 enumerable: true
30 });
31 throw new Test262Error("Expected an exception.");
32 } catch (e) {
33 if (!(e instanceof TypeError)) {
34 throw new Test262Error("Expected TypeError, got " + e);
35 }
36 }
37
38 verifyProperty(arrObj, "1", {
39 value: 3,
40 writable: true,
41 enumerable: false,
42 configurable: false,
43 });
44
45 reportCompare(0, 0);