15.2.3.6-3-1.js (822B)
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-1 10 description: > 11 Object.defineProperty throws TypeError if desc has 'get' and 12 'value' present(8.10.5 step 9.a) 13 ---*/ 14 15 var o = {}; 16 17 // dummy getter 18 var getter = function() { 19 return 1; 20 } 21 var desc = { 22 get: getter, 23 value: 101 24 }; 25 assert.throws(TypeError, function() { 26 Object.defineProperty(o, "foo", desc); 27 }); 28 assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")'); 29 30 reportCompare(0, 0);