| 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-b-237 |
| 6 |
description: > |
| 7 |
Object.defineProperties - 'set' property of 'descObj' is own |
| 8 |
accessor property without a get function that overrides an |
| 9 |
inherited accessor property (8.10.5 step 8.a) |
| 10 |
---*/ |
| 11 |
|
| 12 |
var fun = function() { |
| 13 |
return 10; |
| 14 |
}; |
| 15 |
var proto = {}; |
| 16 |
Object.defineProperty(proto, "set", { |
| 17 |
get: function() { |
| 18 |
return function() { |
| 19 |
return arguments; |
| 20 |
}; |
| 21 |
} |
| 22 |
}); |
| 23 |
|
| 24 |
var Con = function() {}; |
| 25 |
Con.prototype = proto; |
| 26 |
|
| 27 |
var descObj = new Con(); |
| 28 |
Object.defineProperty(descObj, "set", { |
| 29 |
set: function() {} |
| 30 |
}); |
| 31 |
|
| 32 |
descObj.get = fun; |
| 33 |
|
| 34 |
var obj = {}; |
| 35 |
|
| 36 |
Object.defineProperties(obj, { |
| 37 |
prop: descObj |
| 38 |
}); |
| 39 |
|
| 40 |
var desc = Object.getOwnPropertyDescriptor(obj, "prop"); |
| 41 |
|
| 42 |
assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); |
| 43 |
assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); |
| 44 |
assert.sameValue(obj.prop, 10, 'obj.prop'); |