| 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-5-a-4 |
| 6 |
description: > |
| 7 |
Object.defineProperties - enumerable own accessor property of |
| 8 |
'Properties' that overrides enumerable inherited accessor property |
| 9 |
of 'Properties' is defined in 'O' |
| 10 |
---*/ |
| 11 |
|
| 12 |
var obj = {}; |
| 13 |
|
| 14 |
var proto = {}; |
| 15 |
|
| 16 |
Object.defineProperty(proto, "prop", { |
| 17 |
get: function() { |
| 18 |
return { |
| 19 |
value: 9 |
| 20 |
}; |
| 21 |
}, |
| 22 |
enumerable: false |
| 23 |
}); |
| 24 |
|
| 25 |
var Con = function() {}; |
| 26 |
Con.prototype = proto; |
| 27 |
|
| 28 |
var child = new Con(); |
| 29 |
Object.defineProperty(child, "prop", { |
| 30 |
get: function() { |
| 31 |
return { |
| 32 |
value: 12 |
| 33 |
}; |
| 34 |
}, |
| 35 |
enumerable: true |
| 36 |
}); |
| 37 |
Object.defineProperties(obj, child); |
| 38 |
|
| 39 |
assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); |
| 40 |
assert.sameValue(obj.prop, 12, 'obj.prop'); |