15.2.3.7-6-a-67.js (970B)
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.7-6-a-67 6 description: > 7 Object.defineProperties throws TypeError when P is accessor 8 property and P.configurable is false, desc is data property 9 (8.12.9 step 9.a) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 var obj = {}; 14 15 function get_Func() { 16 return 10; 17 } 18 19 Object.defineProperty(obj, "foo", { 20 get: get_Func, 21 configurable: false 22 }); 23 24 try { 25 Object.defineProperties(obj, { 26 foo: { 27 value: 11 28 } 29 }); 30 31 throw new Test262Error("Expected TypeError"); 32 } catch (e) { 33 assert(e instanceof TypeError); 34 35 assert.sameValue(obj.foo, 10); 36 37 verifyProperty(obj, "foo", { 38 enumerable: false, 39 configurable: false, 40 }); 41 42 var desc = Object.getOwnPropertyDescriptor(obj, "foo"); 43 44 assert.sameValue(typeof(desc.set), "undefined"); 45 assert.sameValue(desc.get, get_Func); 46 } 47 48 reportCompare(0, 0);