diff --git a/js/tests/js1_5/Regress/regress-104077.js b/js/tests/js1_5/Regress/regress-104077.js index 723496484727..18f7e01a9efe 100644 --- a/js/tests/js1_5/Regress/regress-104077.js +++ b/js/tests/js1_5/Regress/regress-104077.js @@ -1,24 +1,41 @@ -/* -* The contents of this file are subject to the Netscape Public -* License Version 1.1 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.mozilla.org/NPL/ +/* ***** BEGIN LICENSE BLOCK ***** +* Version: NPL 1.1/GPL 2.0/LGPL 2.1 * -* Software distributed under the License is distributed on an "AS -* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. +* The contents of this file are subject to the Netscape Public License +* Version 1.1 (the "License"); you may not use this file except in +* compliance with the License. You may obtain a copy of the License at +* http://www.mozilla.org/NPL/ * -* The Original Code is mozilla.org code. +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Original Code is JavaScript Engine testing utilities. +* +* The Initial Developer of the Original Code is Netscape Communications Corp. +* Portions created by the Initial Developer are Copyright (C) 2001 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): chwu@nortelnetworks.com, timeless@mac.com, +* pschwartau@netscape.com +* +* Alternatively, the contents of this file may be used under the terms of +* either the GNU General Public License Version 2 or later (the "GPL"), or +* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +* in which case the provisions of the GPL or the LGPL are applicable instead +* of those above. If you wish to allow use of your version of this file only +* under the terms of either the GPL or the LGPL, and not to allow others to +* use your version of this file under the terms of the NPL, indicate your +* decision by deleting the provisions above and replace them with the notice +* and other provisions required by the GPL or the LGPL. If you do not delete +* the provisions above, a recipient may use your version of this file under +* the terms of any one of the NPL, the GPL or the LGPL. +* +* ***** END LICENSE BLOCK ***** * -* The Initial Developer of the Original Code is Netscape -* Communications Corporation. Portions created by Netscape are -* Copyright (C) 1998 Netscape Communications Corporation. -* All Rights Reserved. * -* Contributor(s): chwu@nortelnetworks.com, pschwartau@netscape.com * Date: 10 October 2001 -* * SUMMARY: Regression test for Bugzilla bug 104077 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104077 * @@ -52,7 +69,6 @@ function addValues(obj) } } - status = inSection(1); var obj = new Object(); obj.arg1 = 1; @@ -83,7 +99,6 @@ function tryThis() return i; } - status = inSection(2); actual = tryThis(); expect = 6; @@ -105,7 +120,7 @@ function myTest(x) { throw "ZZZ"; } - catch (e) + catch(e) { print("Caught thrown exception = " + e); } @@ -114,7 +129,6 @@ function myTest(x) return 1; } - status = inSection(3); actual = myTest(null); expect = 1; @@ -122,6 +136,138 @@ captureThis(); +function addValues_2(obj) +{ + var sum = 0; + with (obj) + { + try + { + sum = arg1 + arg2; + with (arg3) + { + while (sum < 10) + { + try + { + // doing something else + if (sum > 5) + return sum; + sum += 1; + } + catch(e) + { + print('Caught an exception in addValues_2() function: ' + e); + } + } + } + } + finally + { + return sum; + } + } +} + +status = inSection(4); +obj = new Object(); +obj.arg1 = 1; +obj.arg2 = 2; +obj.arg3 = new Object(); +obj.arg3.a = 10; +obj.arg3.b = 20; +actual = addValues_2(obj); +expect = 6; +captureThis(); + + + +status = inSection(5); +try +{ + throw new A(); +} +catch(e) +{ +} +finally +{ + try + { + throw new A(); + } + catch(e) + { + } + finally + { + actual = 'a'; + } + actual = 'b'; +} +expect = 'b'; +captureThis(); + + + + +function testfunc(mode) +{ + var obj = new Object(); + with (obj) + { + var num = 100; + var str = "abc" ; + + if (str == null) + { + try + { + throw "authentication.0"; + } + catch(e) + { + } + finally + { + } + + return num; + } + else + { + try + { + if (mode == 0) + throw "authentication.0"; + else + mytest(); + } + catch(e) + { + } + finally + { + } + + return num; + } + } +} + +status = inSection(6); +actual = testfunc(0); +expect = 100; +captureThis(); + +status = inSection(7); +actual = testfunc(); +expect = 100; +captureThis(); + + + + //----------------------------------------------------------------------------- test(); //-----------------------------------------------------------------------------