| 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-76 |
| 6 |
description: > |
| 7 |
Object.defineProperty - desc.[[Get]] and name.[[Get]] are two |
| 8 |
objects which refer to the different objects (8.12.9 step 6) |
| 9 |
includes: [propertyHelper.js] |
| 10 |
---*/ |
| 11 |
|
| 12 |
|
| 13 |
var obj = {}; |
| 14 |
|
| 15 |
function getFunc1() { |
| 16 |
return 10; |
| 17 |
} |
| 18 |
|
| 19 |
function setFunc1(value) { |
| 20 |
obj.helpVerifySet = value; |
| 21 |
} |
| 22 |
|
| 23 |
Object.defineProperty(obj, "foo", { |
| 24 |
get: getFunc1, |
| 25 |
set: setFunc1, |
| 26 |
configurable: true |
| 27 |
}); |
| 28 |
|
| 29 |
function getFunc2() { |
| 30 |
return 20; |
| 31 |
} |
| 32 |
|
| 33 |
Object.defineProperty(obj, "foo", { |
| 34 |
get: getFunc2 |
| 35 |
}); |
| 36 |
verifyEqualTo(obj, "foo", getFunc2()); |
| 37 |
|
| 38 |
verifyWritable(obj, "foo", "helpVerifySet"); |
| 39 |
|
| 40 |
verifyNotEnumerable(obj, "foo"); |
| 41 |
|
| 42 |
verifyConfigurable(obj, "foo"); |