tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-347674.js (1224B)


      1 /* -*- tab-width: 2; 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 var BUGNUMBER     = "347674";
      8 var summary = "ReferenceError thrown when accessing exception bound in a " +
      9  "catch block in a try block within that catch block";
     10 var actual, expect;
     11 
     12 printBugNumber(BUGNUMBER);
     13 printStatus(summary);
     14 
     15 /**************
     16 * BEGIN TEST *
     17 **************/
     18 
     19 var failed = false;
     20 
     21 function foo()
     22 {
     23  try
     24  {
     25    throw "32.9";
     26  }
     27  catch (e)
     28  {
     29    try
     30    {
     31      var errorCode = /^(\d+)\s+.*$/.exec(e)[1];
     32    }
     33    catch (e2)
     34    {
     35      void("*** internal error: e == " + e + ", e2 == " + e2);
     36      throw e2;
     37    }
     38  }
     39 }
     40 
     41 try
     42 {
     43  try
     44  {
     45    foo();
     46  }
     47  catch (ex)
     48  {
     49    if (!(ex instanceof TypeError))
     50      throw "Wrong value thrown!\n" +
     51 "  expected: a TypeError ('32.9' doesn't match the regexp)\n" +
     52 "  actual: " + ex;
     53  }
     54 }
     55 catch (e)
     56 {
     57  failed = e;
     58 }
     59 
     60 expect = false;
     61 actual = failed;
     62 
     63 reportCompare(expect, actual, summary);