| 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.7-6-a-68 |
| 6 |
description: > |
| 7 |
Object.defineProperties throws TypeError when P is data property |
| 8 |
and P.configurable is false, desc is accessor property (8.12.9 |
| 9 |
step 9.a) |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
|
| 14 |
var obj = {}; |
| 15 |
|
| 16 |
Object.defineProperty(obj, "foo", { |
| 17 |
value: 10, |
| 18 |
configurable: false |
| 19 |
}); |
| 20 |
|
| 21 |
function get_func() { |
| 22 |
return 11; |
| 23 |
} |
| 24 |
|
| 25 |
try { |
| 26 |
Object.defineProperties(obj, { |
| 27 |
foo: { |
| 28 |
get: get_func |
| 29 |
} |
| 30 |
}); |
| 31 |
$ERROR("Expected an exception."); |
| 32 |
} catch (e) { |
| 33 |
verifyEqualTo(obj, "foo", 10); |
| 34 |
|
| 35 |
verifyNotWritable(obj, "foo"); |
| 36 |
|
| 37 |
verifyNotEnumerable(obj, "foo"); |
| 38 |
|
| 39 |
verifyNotConfigurable(obj, "foo"); |
| 40 |
|
| 41 |
if (!(e instanceof TypeError)) { |
| 42 |
$ERROR("Expected TypeError, got " + e); |
| 43 |
} |
| 44 |
|
| 45 |
} |