15.2.3.7-6-a-88.js (1131B)
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-88 6 description: > 7 Object.defineProperties throws TypeError when P.configurable is 8 false, P.[[Set]] is undefined, properties.[[Set]] refers to an 9 object (8.12.9 step 11.a.i) 10 includes: [propertyHelper.js] 11 ---*/ 12 13 14 var obj = {}; 15 16 function get_Func() { 17 return 0; 18 } 19 20 Object.defineProperty(obj, "foo", { 21 set: undefined, 22 get: get_Func, 23 enumerable: false, 24 configurable: false 25 }); 26 27 function set_Func() {} 28 29 try { 30 Object.defineProperties(obj, { 31 foo: { 32 set: set_Func 33 } 34 }); 35 throw new Test262Error("Expected an exception."); 36 } catch (e) { 37 if (!(e instanceof TypeError)) { 38 throw new Test262Error("Expected TypeError, got " + e); 39 } 40 } 41 42 verifyProperty(obj, "foo", { 43 enumerable: false, 44 configurable: false, 45 }); 46 47 var desc = Object.getOwnPropertyDescriptor(obj, "foo"); 48 49 if (typeof(desc.set) !== "undefined") { 50 throw new Test262Error('Expected typeof (desc.set) === "undefined", actually ' + typeof(desc.set)); 51 } 52 53 reportCompare(0, 0);