| 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-2 |
| 6 |
description: > |
| 7 |
Object.freeze - The [[Configurable]] attribute of own accessor |
| 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 |
function get_func() { |
| 16 |
return 10; |
| 17 |
} |
| 18 |
|
| 19 |
var set_funcCalled = false; |
| 20 |
|
| 21 |
function set_func() { |
| 22 |
set_funcCalled = true; |
| 23 |
} |
| 24 |
|
| 25 |
Object.defineProperty(obj, "foo", { |
| 26 |
get: get_func, |
| 27 |
set: set_func, |
| 28 |
enumerable: true, |
| 29 |
configurable: true |
| 30 |
}); |
| 31 |
|
| 32 |
Object.freeze(obj); |
| 33 |
|
| 34 |
assert(obj.hasOwnProperty("foo")); |
| 35 |
verifyNotConfigurable(obj, "foo"); |
| 36 |
|
| 37 |
assert.sameValue(obj.foo, 10); |
| 38 |
|
| 39 |
obj.foo = 12; |
| 40 |
assert(set_funcCalled); |
| 41 |
|
| 42 |
verifyEnumerable(obj, "foo"); |
| 43 |
|
| 44 |
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); |
| 45 |
assert.sameValue(desc.configurable, false); |