Home | History | Annotate | Download | only in Exceptions
      1 /*
      2 * The contents of this file are subject to the Netscape Public
      3 * License Version 1.1 (the "License"); you may not use this file
      4 * except in compliance with the License. You may obtain a copy of
      5 * the License at http://www.mozilla.org/NPL/
      6 *
      7 * Software distributed under the License is distributed on an "AS
      8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
      9 * implied. See the License for the specific language governing
     10 * rights and limitations under the License.
     11 *
     12 * The Original Code is mozilla.org code.
     13 *
     14 * The Initial Developer of the Original Code is Netscape
     15 * Communications Corporation.  Portions created by Netscape are
     16 * Copyright (C) 1998 Netscape Communications Corporation. All
     17 * Rights Reserved.
     18 *
     19 * Contributor(s): pschwartau (at) netscape.com
     20 *
     21 *
     22 *This test arose from Bugzilla bug 58946.
     23 *The bug was filed when we got the following error (see code below):
     24 *
     25 *                          "ReferenceError: e is not defined"
     26 *
     27 *There was no error if we replaced "return e" in the code below with "print(e)".
     28 *There should be no error with "return e", either  -
     29 */
     30 //-------------------------------------------------------------------------------------------------
     31 var bug = '58946';
     32 var stat =  'Testing a return statement inside a catch statement inside a function';
     33 
     34 
     35 test();
     36 
     37 
     38 function test() {
     39   enterFunc ("test");
     40   printBugNumber (bug);
     41   printStatus (stat);
     42 
     43 
     44   try
     45   {
     46     throw 'PASS';
     47    }
     48 
     49   catch(e)
     50   {
     51      return e;
     52   }
     53 
     54 
     55   exitFunc ("test");
     56 }