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