Debian Codegraph @

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