| 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.9-2-c-1 |
| 6 |
description: > |
| 7 |
Object.freeze - The [[Configurable]] attribute of own data |
| 8 |
property of 'O' is set to false while other attributes are |
| 9 |
unchanged |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
var obj = {}; |
| 14 |
|
| 15 |
Object.defineProperty(obj, "foo", { |
| 16 |
value: 10, |
| 17 |
writable: false, |
| 18 |
enumerable: true, |
| 19 |
configurable: true |
| 20 |
}); |
| 21 |
|
| 22 |
Object.freeze(obj); |
| 23 |
|
| 24 |
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); |
| 25 |
|
| 26 |
if (desc.configurable !== false) { |
| 27 |
$ERROR("Expected desc.configurable to be false, actually " + desc.configurable); |
| 28 |
} |
| 29 |
if (desc.writable !== false) { |
| 30 |
$ERROR("Expected desc.writable to be false, actually " + desc.writable); |
| 31 |
} |
| 32 |
|
| 33 |
verifyEqualTo(obj, "foo", 10); |
| 34 |
|
| 35 |
verifyNotWritable(obj, "foo"); |
| 36 |
|
| 37 |
verifyEnumerable(obj, "foo"); |
| 38 |
|
| 39 |
verifyNotConfigurable(obj, "foo"); |