S15.3.5.3_A2_T5.js (1127B)
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 Assume F is a Function object. When the [[HasInstance]] method of 7 F is called with value V and V is an object, the following steps 8 are taken: i) Call the [[Get]] method of F with property name 9 "prototype". ii) Let O be Result(i). iii) O is not an object, 10 throw a TypeError exception 11 es5id: 15.3.5.3_A2_T5 12 description: F.prototype is void 0, and V is new F 13 ---*/ 14 15 var FACTORY; 16 FACTORY = Function("this.prop=1;"); 17 18 FACTORY.prototype.name = "fairy"; 19 20 var instance; 21 instance = new FACTORY; 22 23 FACTORY.prototype = void 0; 24 25 // CHECK#1 26 try { 27 instance instanceof FACTORY; 28 throw new Test262Error('#1: O is not an object, throw a TypeError exception'); 29 } catch (e) { 30 if (!(e instanceof TypeError)) { 31 throw new Test262Error('#1.1: O is not an object, throw a TypeError exception'); 32 } 33 } 34 35 // CHECK#2 36 if ((instance.constructor !== FACTORY) || (instance.name !== "fairy")) { 37 throw new Test262Error('#2: instance.constructor === FACTORY'); 38 } 39 40 reportCompare(0, 0);