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