michael@0: // Copyright 2009 the Sputnik authors. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * Since a function is an object, it might be set to [[Prototype]] property of a new created object through [[Construct]] property, michael@0: * but [[call]] property must fail with TypeError error michael@0: * michael@0: * @path ch13/13.2/S13.2.2_A2.js michael@0: * @description Trying to [[call]] this function michael@0: */ michael@0: michael@0: var __PLANT="flower"; michael@0: var __ROSE="rose"; michael@0: michael@0: function __PROTO(){}; michael@0: michael@0: try{ michael@0: __PROTO.type=__PLANT; michael@0: } michael@0: catch(e){ michael@0: $ERROR('#0: __PROTO.type=__PLANT does not lead to throwing exception') michael@0: } michael@0: michael@0: function __FACTORY(){this.name=__ROSE}; michael@0: michael@0: __FACTORY.prototype=__PROTO; michael@0: michael@0: var __rose = new __FACTORY(); michael@0: michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: //CHECK#1 michael@0: try{ michael@0: __rose(); michael@0: $ERROR('#1: __rose() lead to throwing exception'); michael@0: } catch(e){ michael@0: if (!(e instanceof TypeError)) { michael@0: $ERROR('#2: Exception Type is TypeError. Actual: exception ==='+e); michael@0: } michael@0: } michael@0: // michael@0: ////////////////////////////////////////////////////////////////////////////// michael@0: