| 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-88 |
| 6 |
description: > |
| 7 |
Object.defineProperties throws TypeError when P.configurable is |
| 8 |
false, P.[[Set]] is undefined, properties.[[Set]] refers to an |
| 9 |
object (8.12.9 step 11.a.i) |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
|
| 14 |
var obj = {}; |
| 15 |
|
| 16 |
function get_Func() { |
| 17 |
return 0; |
| 18 |
} |
| 19 |
|
| 20 |
Object.defineProperty(obj, "foo", { |
| 21 |
set: undefined, |
| 22 |
get: get_Func, |
| 23 |
enumerable: false, |
| 24 |
configurable: false |
| 25 |
}); |
| 26 |
|
| 27 |
function set_Func() {} |
| 28 |
|
| 29 |
try { |
| 30 |
Object.defineProperties(obj, { |
| 31 |
foo: { |
| 32 |
set: set_Func |
| 33 |
} |
| 34 |
}); |
| 35 |
$ERROR("Expected an exception."); |
| 36 |
} catch (e) { |
| 37 |
verifyNotEnumerable(obj, "foo"); |
| 38 |
|
| 39 |
verifyNotConfigurable(obj, "foo"); |
| 40 |
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); |
| 41 |
|
| 42 |
if (typeof(desc.set) !== "undefined") { |
| 43 |
$ERROR('Expected typeof (desc.set) === "undefined", actually ' + typeof(desc.set)); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
if (!(e instanceof TypeError)) { |
| 48 |
$ERROR("Expected TypeError, got " + e); |
| 49 |
} |
| 50 |
|
| 51 |
} |