15.2.3.6-3-246.js (963B)
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.6-3-246 6 description: > 7 Object.defineProperty - 'set' property in 'Attributes' is own 8 accessor property(without a get function) that overrides an 9 inherited accessor property (8.10.5 step 8.a) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = {}; 14 var proto = {}; 15 var data = "data"; 16 Object.defineProperty(proto, "set", { 17 get: function() { 18 return function(value) { 19 data = value; 20 }; 21 } 22 }); 23 24 var ConstructFun = function() {}; 25 ConstructFun.prototype = proto; 26 27 var child = new ConstructFun(); 28 Object.defineProperty(child, "set", { 29 set: function() {} 30 }); 31 32 Object.defineProperty(obj, "property", child); 33 34 verifyNotWritable(obj, "property"); 35 36 assert.sameValue(typeof obj.property, "undefined"); 37 assert.sameValue(data, "data"); 38 39 assert(obj.hasOwnProperty("property")); 40 41 reportCompare(0, 0);