Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-91.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-91
6 description: >
7 Object.defineProperties throws TypeError when P.configurable is
8 false, both properties.[[Get]] and P.[[Get]] are two objects which
9 refer to different objects (8.12.9 step 11.a.ii)
10 includes: [propertyHelper.js]
11 ---*/
12
13
14 var obj = {};
15
16 function set_func(value) {
17 obj.setVerifyHelpProp = value;
18 }
19
20 function get_func1() {
21 return 10;
22 }
23
24 Object.defineProperty(obj, "foo", {
25 get: get_func1,
26 set: set_func,
27 enumerable: false,
28 configurable: false
29 });
30
31 function get_func2() {
32 return 20;
33 }
34
35 try {
36 Object.defineProperties(obj, {
37 foo: {
38 get: get_func2
39 }
40 });
41 $ERROR("Expected an exception");
42 } catch (e) {
43 verifyEqualTo(obj, "foo", get_func1());
44
45 verifyWritable(obj, "foo", "setVerifyHelpProp");
46
47 verifyNotEnumerable(obj, "foo");
48
49 verifyNotConfigurable(obj, "foo");
50
51 if (!(e instanceof TypeError)) {
52 $ERROR("Expected TypeError, got " + e);
53 }
54
55 }