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