8.12.9-9-c-i_1.js (1015B)
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: 8.12.9-9-c-i_1 6 description: > 7 Redefine a configurable accessor property to be a data property on 8 a non-extensible object 9 ---*/ 10 11 var o = {}; 12 Object.defineProperty(o, "foo", 13 { 14 get: function() { 15 return 5; 16 }, 17 configurable: true 18 }); 19 Object.preventExtensions(o); 20 Object.defineProperty(o, "foo", { 21 value: "hello" 22 }); 23 24 var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); 25 26 assert.sameValue(o.foo, "hello", 'o.foo'); 27 assert.sameValue(fooDescrip.get, undefined, 'fooDescrip.get'); 28 assert.sameValue(fooDescrip.set, undefined, 'fooDescrip.set'); 29 assert.sameValue(fooDescrip.value, "hello", 'fooDescrip.value'); 30 assert.sameValue(fooDescrip.configurable, true, 'fooDescrip.configurable'); 31 assert.sameValue(fooDescrip.enumerable, false, 'fooDescrip.enumerable'); 32 assert.sameValue(fooDescrip.writable, false, 'fooDescrip.writable'); 33 34 reportCompare(0, 0);