Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-244.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-244
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' and the [[Get]] attribute value of 'P' are
12 two objects which refer to the different objects (15.4.5.1 step
13 4.c)
14 includes: [propertyHelper.js]
15 ---*/
16
17 var arr = [];
18
19 function get_fun() {
20 return 36;
21 }
22 Object.defineProperty(arr, "1", {
23 get: get_fun
24 });
25
26 try {
27 Object.defineProperties(arr, {
28 "1": {
29 get: function() {
30 return 12;
31 }
32 }
33 });
34
35 $ERROR("Expected an exception.");
36 } catch (e) {
37 verifyEqualTo(arr, "1", get_fun());
38
39 verifyNotEnumerable(arr, "1");
40
41 verifyNotConfigurable(arr, "1");
42
43 if (!(e instanceof TypeError)) {
44 $ERROR("Expected TypeError, got " + e);
45 }
46
47 }