1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_2/instanceof/instanceof-003.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: instanceof-003.js 1.12 + ECMA Section: 1.13 + Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 1.14 + 1.15 + js> function Foo() {} 1.16 + js> theproto = {}; 1.17 + [object Object] 1.18 + js> Foo.prototype = theproto 1.19 + [object Object] 1.20 + js> theproto instanceof Foo 1.21 + true 1.22 + 1.23 + I think this should be 'false' 1.24 + 1.25 + 1.26 + Author: christine@netscape.com 1.27 + Date: 12 november 1997 1.28 + 1.29 + Modified to conform to ECMA3 1.30 + https://bugzilla.mozilla.org/show_bug.cgi?id=281606 1.31 +*/ 1.32 +var SECTION = "instanceof-003"; 1.33 +var VERSION = "ECMA_2"; 1.34 +var TITLE = "instanceof operator"; 1.35 +var BUGNUMBER ="7635"; 1.36 + 1.37 +startTest(); 1.38 + 1.39 +function Foo() {}; 1.40 +theproto = {}; 1.41 +Foo.prototype = theproto; 1.42 + 1.43 +AddTestCase( 1.44 + "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " + 1.45 + "theproto instanceof Foo", 1.46 + false, 1.47 + theproto instanceof Foo ); 1.48 + 1.49 + 1.50 +var o = {}; 1.51 + 1.52 +// https://bugzilla.mozilla.org/show_bug.cgi?id=281606 1.53 +try 1.54 +{ 1.55 + AddTestCase( 1.56 + "o = {}; o instanceof o", 1.57 + "error", 1.58 + o instanceof o ); 1.59 +} 1.60 +catch(e) 1.61 +{ 1.62 + AddTestCase( 1.63 + "o = {}; o instanceof o", 1.64 + "error", 1.65 + "error" ); 1.66 +} 1.67 + 1.68 +test();