Debian Codegraph @

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