Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-241.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-241
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 [[Set]] field of 'desc' is present, and the
11 [[Set]] field of 'desc' and the [[Set]] 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 set_fun(value) {
20 arr.setVerifyHelpProp = value;
21 }
22 Object.defineProperty(arr, "1", {
23 set: set_fun
24 });
25
26 try {
27 Object.defineProperties(arr, {
28 "1": {
29 set: function() {}
30 }
31 });
32
33 $ERROR("Expected an exception.");
34 } catch (e) {
35 verifyWritable(arr, "1", "setVerifyHelpProp");
36
37 verifyNotEnumerable(arr, "1");
38
39 verifyNotConfigurable(arr, "1");
40
41 if (!(e instanceof TypeError)) {
42 $ERROR("Expected TypeError, got " + e);
43 }
44
45 }