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