S13.2.2_A2.js (1124B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 Since a function is an object, it might be set to [[Prototype]] property of a new created object through [[Construct]] property, 7 but [[call]] property must fail with TypeError error 8 es5id: 13.2.2_A2 9 description: Trying to [[call]] this function 10 ---*/ 11 12 var __PLANT="flower"; 13 var __ROSE="rose"; 14 15 function __PROTO(){}; 16 17 try{ 18 __PROTO.type=__PLANT; 19 } 20 catch(e){ 21 throw new Test262Error('#0: __PROTO.type=__PLANT does not lead to throwing exception') 22 } 23 24 function __FACTORY(){}; 25 26 __FACTORY.prototype=__PROTO; 27 28 var __rose = new __FACTORY(); 29 30 ////////////////////////////////////////////////////////////////////////////// 31 //CHECK#1 32 try{ 33 __rose(); 34 throw new Test262Error('#1: __rose() lead to throwing exception'); 35 } catch(e){ 36 if (!(e instanceof TypeError)) { 37 throw new Test262Error('#2: Exception Type is TypeError. Actual: exception ==='+e); 38 } 39 } 40 // 41 ////////////////////////////////////////////////////////////////////////////// 42 43 reportCompare(0, 0);