| 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-87 |
| 6 |
description: > |
| 7 |
Object.defineProperties throws TypeError when P.configurable is |
| 8 |
false, both properties.[[Set]] and P.[[Set]] are two objects which |
| 9 |
refer to different objects (8.12.9 step 11.a.i) |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
|
| 14 |
var obj = {}; |
| 15 |
|
| 16 |
function set_func1(value) { |
| 17 |
obj.setVerifyHelpProp = value; |
| 18 |
} |
| 19 |
|
| 20 |
Object.defineProperty(obj, "foo", { |
| 21 |
set: set_func1, |
| 22 |
configurable: false |
| 23 |
}); |
| 24 |
|
| 25 |
function set_func2() {} |
| 26 |
|
| 27 |
try { |
| 28 |
Object.defineProperties(obj, { |
| 29 |
foo: { |
| 30 |
set: set_func2 |
| 31 |
} |
| 32 |
}); |
| 33 |
$ERROR("Expected an exception."); |
| 34 |
} catch (e) { |
| 35 |
verifyWritable(obj, "foo", "setVerifyHelpProp"); |
| 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 |
} |