Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-288.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-288
6 description: >
7 Object.defineProperties - 'O' is an Arguments object, 'P' is own
8 accessor property of 'O' which is also defined in [[ParameterMap]]
9 of 'O', test TypeError is thrown when updating the [[Enumerable]]
10 attribute value of 'P' which is defined as non-configurable (10.6
11 [[DefineOwnProperty]] step 4)
12 includes: [propertyHelper.js]
13 ---*/
14
15
16 var arg;
17
18 (function fun(a, b, c) {
19 arg = arguments;
20 }(0, 1, 2));
21
22 function get_func() {
23 return 0;
24 }
25
26 Object.defineProperty(arg, "0", {
27 get: get_func,
28 enumerable: true,
29 configurable: false
30 });
31
32 try {
33 Object.defineProperties(arg, {
34 "0": {
35 enumerable: false
36 }
37 });
38
39 $ERROR("Expected an exception.");
40 } catch (e) {
41 verifyEqualTo(arg, "0", get_func());
42
43 verifyEnumerable(arg, "0");
44
45 verifyNotConfigurable(arg, "0");
46
47 if (!(e instanceof TypeError)) {
48 $ERROR("Expected TypeError, got " + e);
49 }
50
51 }