object-seal-p-is-own-accessor-property-that-overrides-an-inherited-data-property.js (771B)
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 esid: sec-setintegritylevel 6 description: > 7 Object.seal - 'P' is own accessor property that overrides an 8 inherited data property 9 includes: [propertyHelper.js] 10 ---*/ 11 12 var proto = {}; 13 14 Object.defineProperty(proto, "foo", { 15 value: 0, 16 configurable: true 17 }); 18 19 var ConstructFun = function() {}; 20 ConstructFun.prototype = proto; 21 22 var obj = new ConstructFun(); 23 24 Object.defineProperty(obj, "foo", { 25 get: function() { 26 return 10; 27 }, 28 configurable: true 29 }); 30 31 assert(Object.isExtensible(obj)); 32 Object.seal(obj); 33 34 verifyProperty(obj, "foo", { 35 configurable: false, 36 }); 37 38 assert.sameValue(obj.foo, 10); 39 40 reportCompare(0, 0);