Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-373.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-373
6 description: >
7 ES5 Attributes - success to update [[Configurable]] attribute of
8 data property ([[Writable]] is false, [[Enumerable]] is false,
9 [[Configurable]] is true) to different value
10 ---*/
11
12 var obj = {};
13
14 Object.defineProperty(obj, "prop", {
15 value: 2010,
16 writable: false,
17 enumerable: false,
18 configurable: true
19 });
20 var propertyDefineCorrect = obj.hasOwnProperty("prop");
21 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
22
23 Object.defineProperty(obj, "prop", {
24 configurable: false
25 });
26 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
27
28 assert(propertyDefineCorrect, 'propertyDefineCorrect !== true');
29 assert.sameValue(desc1.configurable, true, 'desc1.configurable');
30 assert.sameValue(obj.prop, 2010, 'obj.prop');
31 assert.sameValue(desc2.configurable, false, 'desc2.configurable');