regress-192226.js (1572B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* 7 * 8 * Date: 07 February 2003 9 * SUMMARY: Testing a nested function call under |with| or |catch| 10 * 11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=192226 12 * 13 */ 14 //----------------------------------------------------------------------------- 15 var UBound = 0; 16 var BUGNUMBER = 192226; 17 var summary = 'Testing a nested function call under |with| or |catch|'; 18 var status = ''; 19 var statusitems = []; 20 var actual = ''; 21 var actualvalues = []; 22 var expect= ''; 23 var expectedvalues = []; 24 var counter = 0; 25 26 27 function f() 28 { 29 try 30 { 31 with (Math) 32 { 33 test0(); 34 test1(sin); 35 } 36 throw 1; 37 } 38 catch (e) 39 { 40 test0(); 41 test1(e); 42 } 43 } 44 45 function test0() 46 { 47 ++counter; 48 } 49 50 function test1(arg) 51 { 52 ++counter; 53 } 54 55 56 status = inSection(1); 57 f(); // sets |counter| 58 actual = counter; 59 expect = 4; 60 addThis(); 61 62 63 64 //----------------------------------------------------------------------------- 65 test(); 66 //----------------------------------------------------------------------------- 67 68 69 70 function addThis() 71 { 72 statusitems[UBound] = status; 73 actualvalues[UBound] = actual; 74 expectedvalues[UBound] = expect; 75 UBound++; 76 } 77 78 79 function test() 80 { 81 printBugNumber(BUGNUMBER); 82 printStatus(summary); 83 84 for (var i=0; i<UBound; i++) 85 { 86 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); 87 } 88 }