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: 04 September 2001 michael@0: * michael@0: * SUMMARY: Regression test for Bugzilla bug 98306 michael@0: * "JS parser crashes in ParseAtom for script using Regexp()" michael@0: * michael@0: * See http://bugzilla.mozilla.org/show_bug.cgi?id=98306 michael@0: */ michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 98306; michael@0: var summary = "Testing that we don't crash on this code -"; michael@0: var cnUBOUND = 10; michael@0: var re; michael@0: var s; 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: s = '"Hello".match(/[/]/)'; michael@0: tryThis(s); michael@0: michael@0: s = 're = /[/'; michael@0: tryThis(s); michael@0: michael@0: s = 're = /[/]/'; michael@0: tryThis(s); michael@0: michael@0: s = 're = /[//]/'; michael@0: tryThis(s); michael@0: michael@0: reportCompare('No Crash', 'No Crash', ''); michael@0: exitFunc ('test'); michael@0: } michael@0: michael@0: michael@0: // Try to provoke a crash - michael@0: function tryThis(sCode) michael@0: { michael@0: // sometimes more than one attempt is necessary - michael@0: for (var i=0; i