| 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.6-4-252 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Array, 'name' is an array index |
| 8 |
named property, 'name' is accessor property and 'desc' is accessor |
| 9 |
descriptor, and the [[Configurable]] attribute value of 'name' is |
| 10 |
false, test TypeError is thrown if the [[Set]] field of 'desc' is |
| 11 |
present, and the [[Set]] field of 'desc' and the [[Set]] attribute |
| 12 |
value of 'name' are two objects which refer to the different |
| 13 |
objects (15.4.5.1 step 4.c) |
| 14 |
includes: [propertyHelper.js] |
| 15 |
---*/ |
| 16 |
|
| 17 |
var arrObj = []; |
| 18 |
|
| 19 |
function setFunc(value) { |
| 20 |
arrObj.setVerifyHelpProp = value; |
| 21 |
} |
| 22 |
Object.defineProperty(arrObj, "1", { |
| 23 |
set: setFunc |
| 24 |
}); |
| 25 |
|
| 26 |
try { |
| 27 |
Object.defineProperty(arrObj, "1", { |
| 28 |
set: function() {} |
| 29 |
}); |
| 30 |
$ERROR("Expected an exception."); |
| 31 |
|
| 32 |
} catch (e) { |
| 33 |
verifyWritable(arrObj, "1", "setVerifyHelpProp"); |
| 34 |
|
| 35 |
verifyNotEnumerable(arrObj, "1"); |
| 36 |
|
| 37 |
verifyNotConfigurable(arrObj, "1"); |
| 38 |
|
| 39 |
if (!(e instanceof TypeError)) { |
| 40 |
$ERROR("Expected TypeError, got " + e); |
| 41 |
} |
| 42 |
|
| 43 |
} |