15.2.3.6-3-14.js (810B)
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 info: | 6 The abtract operation ToPropertyDescriptor is used to package the 7 into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError 8 if the property desc ends up having a mix of accessor and data property elements. 9 es5id: 15.2.3.6-3-14 10 description: > 11 Object.defineProperty throws TypeError if setter is not callable 12 but not undefined (Object)(8.10.5 step 8.b) 13 ---*/ 14 15 var o = {}; 16 17 // dummy getter 18 var setter = { 19 a: 1 20 }; 21 var desc = { 22 set: setter 23 }; 24 assert.throws(TypeError, function() { 25 Object.defineProperty(o, "foo", desc); 26 }); 27 assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); 28 29 reportCompare(0, 0);