|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 |
|
7 /** |
|
8 File Name: instanceof-003.js |
|
9 ECMA Section: |
|
10 Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 |
|
11 |
|
12 js> function Foo() {} |
|
13 js> theproto = {}; |
|
14 [object Object] |
|
15 js> Foo.prototype = theproto |
|
16 [object Object] |
|
17 js> theproto instanceof Foo |
|
18 true |
|
19 |
|
20 I think this should be 'false' |
|
21 |
|
22 |
|
23 Author: christine@netscape.com |
|
24 Date: 12 november 1997 |
|
25 |
|
26 Modified to conform to ECMA3 |
|
27 https://bugzilla.mozilla.org/show_bug.cgi?id=281606 |
|
28 */ |
|
29 var SECTION = "instanceof-003"; |
|
30 var VERSION = "ECMA_2"; |
|
31 var TITLE = "instanceof operator"; |
|
32 var BUGNUMBER ="7635"; |
|
33 |
|
34 startTest(); |
|
35 |
|
36 function Foo() {}; |
|
37 theproto = {}; |
|
38 Foo.prototype = theproto; |
|
39 |
|
40 AddTestCase( |
|
41 "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " + |
|
42 "theproto instanceof Foo", |
|
43 false, |
|
44 theproto instanceof Foo ); |
|
45 |
|
46 |
|
47 var o = {}; |
|
48 |
|
49 // https://bugzilla.mozilla.org/show_bug.cgi?id=281606 |
|
50 try |
|
51 { |
|
52 AddTestCase( |
|
53 "o = {}; o instanceof o", |
|
54 "error", |
|
55 o instanceof o ); |
|
56 } |
|
57 catch(e) |
|
58 { |
|
59 AddTestCase( |
|
60 "o = {}; o instanceof o", |
|
61 "error", |
|
62 "error" ); |
|
63 } |
|
64 |
|
65 test(); |