Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-99.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.6-4-99
6 description: >
7 Object.defineProperty will throw TypeError when name.configurable
8 = false, name.[[Get]] is undefined, desc.[[Get]] refers to an
9 object (8.12.9 step 11.a.ii)
10 includes: [propertyHelper.js]
11 ---*/
12
13
14 var obj = {};
15
16 function setFunc(value) {
17 obj.setVerifyHelpProp = value;
18 }
19
20 Object.defineProperty(obj, "foo", {
21 set: setFunc,
22 configurable: false
23 });
24
25 function getFunc() {
26 return 10;
27 }
28
29 try {
30 Object.defineProperty(obj, "foo", {
31 get: getFunc,
32 set: setFunc
33 });
34 $ERROR("Expected an exception.");
35 } catch (e) {
36 verifyWritable(obj, "foo", "setVerifyHelpProp");
37
38 verifyNotEnumerable(obj, "foo");
39
40 verifyNotConfigurable(obj, "foo");
41
42 if (!(e instanceof TypeError)) {
43 $ERROR("Expected TypeError, got " + e);
44 }
45
46 }