| 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.3-3-8 |
| 6 |
description: > |
| 7 |
Object.getOwnPropertyDescriptor - 'P' is own accessor property |
| 8 |
that overrides an inherited accessor property |
| 9 |
---*/ |
| 10 |
|
| 11 |
var proto = {}; |
| 12 |
Object.defineProperty(proto, "property", { |
| 13 |
get: function() { |
| 14 |
return "inheritedAccessorProperty"; |
| 15 |
}, |
| 16 |
configurable: true |
| 17 |
}); |
| 18 |
|
| 19 |
var Con = function() {}; |
| 20 |
Con.ptototype = proto; |
| 21 |
|
| 22 |
var child = new Con(); |
| 23 |
var fun = function() { |
| 24 |
return "ownAccessorProperty"; |
| 25 |
}; |
| 26 |
Object.defineProperty(child, "property", { |
| 27 |
get: fun, |
| 28 |
configurable: true |
| 29 |
}); |
| 30 |
|
| 31 |
var desc = Object.getOwnPropertyDescriptor(child, "property"); |
| 32 |
|
| 33 |
assert.sameValue(desc.get, fun, 'desc.get'); |