Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/instanceof/S15.3.5.3_A2_T6.js

raw
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_T6
12 description: F.prototype is string, and V is function
13 ---*/
14
15 var FACTORY;
16 FACTORY = new Function;
17
18 FACTORY.prototype = "error";
19
20 // CHECK#1
21 try {
22 ( function() {
23 }) instanceof FACTORY;
24 $ERROR('#1: O is not an object, throw a TypeError exception');
25 } catch (e) {
26 if (!(e instanceof TypeError)) {
27 $ERROR('#1.1: O is not an object, throw a TypeError exception');
28 }
29 }