Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-233.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.7-6-a-233
6 description: >
7 Object.defineProperties - 'O' is an Array, 'P' is an array index
8 property, 'P' is data property and 'desc' is data descriptor, and
9 the [[Configurable]] attribute value of 'P' is false, test
10 TypeError is thrown if the [[Writable]] attribute value of 'P' is
11 false and the [[Writable]] field of 'desc' is true. (15.4.5.1
12 step 4.c)
13 includes: [propertyHelper.js]
14 ---*/
15
16
17 var arr = [];
18
19 Object.defineProperty(arr, "1", {
20 configurable: false,
21 writable: false
22
23 });
24
25 try {
26 Object.defineProperties(arr, {
27 "1": {
28 writable: true
29 }
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(arr, "1", {
39 value: undefined,
40 writable: false,
41 enumerable: false,
42 configurable: false,
43 });
44
45 reportCompare(0, 0);