8.12.9-9-c-i_2.js (1032B)
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_2 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 { 22 value: "hello", 23 writable: true 24 }); 25 26 var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); 27 28 assert.sameValue(o.foo, "hello", 'o.foo'); 29 assert.sameValue(fooDescrip.get, undefined, 'fooDescrip.get'); 30 assert.sameValue(fooDescrip.set, undefined, 'fooDescrip.set'); 31 assert.sameValue(fooDescrip.value, "hello", 'fooDescrip.value'); 32 assert.sameValue(fooDescrip.configurable, true, 'fooDescrip.configurable'); 33 assert.sameValue(fooDescrip.enumerable, false, 'fooDescrip.enumerable'); 34 assert.sameValue(fooDescrip.writable, true, 'fooDescrip.writable'); 35 36 reportCompare(0, 0);