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: * Date: 29 Aug 2001 michael@0: * michael@0: * SUMMARY: Negative test that JS infinite recursion protection works. michael@0: * We expect the code here to fail (i.e. exit code 3), but NOT crash. michael@0: * michael@0: * See http://bugzilla.mozilla.org/show_bug.cgi?id=96128 michael@0: */ michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 96128; michael@0: var summary = 'Testing that JS infinite recursion protection works'; michael@0: michael@0: michael@0: function objRecurse() michael@0: { michael@0: /* michael@0: * jband: michael@0: * michael@0: * Causes a stack overflow crash in debug builds of both the browser michael@0: * and the shell. In the release builds this is safely caught by the michael@0: * "too much recursion" mechanism. If I remove the 'new' from the code below michael@0: * this is safely caught in both debug and release builds. The 'new' causes a michael@0: * lookup for the Constructor name and seems to (at least) double the number michael@0: * of items on the C stack for the given interpLevel depth. michael@0: */ michael@0: return new objRecurse(); michael@0: } michael@0: michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: // we expect this to fail (exit code 3), but NOT crash. - michael@0: var obj = new objRecurse(); michael@0: michael@0: exitFunc ('test'); michael@0: }