michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: instanceof-003.js michael@0: ECMA Section: michael@0: Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 michael@0: michael@0: js> function Foo() {} michael@0: js> theproto = {}; michael@0: [object Object] michael@0: js> Foo.prototype = theproto michael@0: [object Object] michael@0: js> theproto instanceof Foo michael@0: true michael@0: michael@0: I think this should be 'false' michael@0: michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 12 november 1997 michael@0: michael@0: Modified to conform to ECMA3 michael@0: https://bugzilla.mozilla.org/show_bug.cgi?id=281606 michael@0: */ michael@0: var SECTION = "instanceof-003"; michael@0: var VERSION = "ECMA_2"; michael@0: var TITLE = "instanceof operator"; michael@0: var BUGNUMBER ="7635"; michael@0: michael@0: startTest(); michael@0: michael@0: function Foo() {}; michael@0: theproto = {}; michael@0: Foo.prototype = theproto; michael@0: michael@0: AddTestCase( michael@0: "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " + michael@0: "theproto instanceof Foo", michael@0: false, michael@0: theproto instanceof Foo ); michael@0: michael@0: michael@0: var o = {}; michael@0: michael@0: // https://bugzilla.mozilla.org/show_bug.cgi?id=281606 michael@0: try michael@0: { michael@0: AddTestCase( michael@0: "o = {}; o instanceof o", michael@0: "error", michael@0: o instanceof o ); michael@0: } michael@0: catch(e) michael@0: { michael@0: AddTestCase( michael@0: "o = {}; o instanceof o", michael@0: "error", michael@0: "error" ); michael@0: } michael@0: michael@0: test();