Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-546.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-546
6 description: >
7 ES5 Attributes - fail to update [[Configurable]] attribute of
8 accessor property ([[Get]] is a Function, [[Set]] is a Function,
9 [[Enumerable]] is true, [[Configurable]] is false) to different
10 value
11 includes: [propertyHelper.js]
12 ---*/
13
14 var obj = {};
15
16 var getFunc = function() {
17 return 1001;
18 };
19
20 var verifySetFunc = "data";
21 var setFunc = function(value) {
22 verifySetFunc = value;
23 };
24
25 Object.defineProperty(obj, "prop", {
26 get: getFunc,
27 set: setFunc,
28 enumerable: true,
29 configurable: false
30 });
31 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
32 assert.sameValue(desc1.configurable, false);
33
34 try {
35 Object.defineProperty(obj, "prop", {
36 configurable: true
37 });
38
39 throw new Test262Error("Expected TypeError");
40 } catch (e) {
41 assert(e instanceof TypeError);
42 }
43
44 verifyProperty(obj, "prop", {
45 configurable: false,
46 });
47
48 reportCompare(0, 0);