Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-245.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-245
6 description: >
7 Object.defineProperties - TypeError is thrown if 'O' is an Array,
8 'P' is an array index named property that already exists on 'O' is
9 accessor property with [[Configurable]] false, 'desc' is accessor
10 descriptor, the [[Get]] field of 'desc' is present, and the
11 [[Get]] field of 'desc' is an object and the [[Get]] attribute
12 value of 'P' is undefined (15.4.5.1 step 4.c)
13 includes: [propertyHelper.js]
14 ---*/
15
16 var arr = [];
17
18 function get_fun() {
19 return 36;
20 }
21 Object.defineProperty(arr, "1", {
22 get: get_fun
23 });
24
25 try {
26 Object.defineProperties(arr, {
27 "1": {
28 get: undefined
29 }
30 });
31 throw new Test262Error("Expected an exception.");
32 } catch (e) {
33 verifyEqualTo(arr, "1", get_fun());
34
35 if (!(e instanceof TypeError)) {
36 throw new Test262Error("Expected TypeError, got " + e);
37 }
38 }
39
40 verifyProperty(arr, "1", {
41 enumerable: false,
42 configurable: false,
43 });
44
45 reportCompare(0, 0);