| 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-531-11 |
| 6 |
description: > |
| 7 |
Object.defineProperty will update [[Get]] and [[Set]] attributes |
| 8 |
of named accessor property 'P' successfully when [[Configurable]] |
| 9 |
attribute is true, 'A' is an Array object (8.12.9 step 11) |
| 10 |
includes: [propertyHelper.js] |
| 11 |
---*/ |
| 12 |
|
| 13 |
|
| 14 |
var obj = []; |
| 15 |
|
| 16 |
obj.verifySetFunction = "data"; |
| 17 |
Object.defineProperty(obj, "prop", { |
| 18 |
get: function() { |
| 19 |
return obj.verifySetFunction; |
| 20 |
}, |
| 21 |
set: function(value) { |
| 22 |
obj.verifySetFunction = value; |
| 23 |
}, |
| 24 |
configurable: true |
| 25 |
}); |
| 26 |
|
| 27 |
obj.verifySetFunction1 = "data1"; |
| 28 |
var getFunc = function() { |
| 29 |
return obj.verifySetFunction1; |
| 30 |
}; |
| 31 |
var setFunc = function(value) { |
| 32 |
obj.verifySetFunction1 = value; |
| 33 |
}; |
| 34 |
|
| 35 |
Object.defineProperty(obj, "prop", { |
| 36 |
get: getFunc, |
| 37 |
set: setFunc |
| 38 |
}); |
| 39 |
|
| 40 |
verifyEqualTo(obj, "prop", getFunc()); |
| 41 |
|
| 42 |
verifyWritable(obj, "prop", "verifySetFunction1"); |
| 43 |
|
| 44 |
verifyNotEnumerable(obj, "prop"); |
| 45 |
|
| 46 |
verifyConfigurable(obj, "prop"); |