js/src/tests/js1_5/Exceptions/regress-273931.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/Exceptions/regress-273931.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//-----------------------------------------------------------------------------
    1.10 +var BUGNUMBER = 273931;
    1.11 +var summary = 'Pop scope chain in exception handling';
    1.12 +var actual = '';
    1.13 +var expect = 'ReferenceError';
    1.14 +
    1.15 +printBugNumber(BUGNUMBER);
    1.16 +printStatus (summary);
    1.17 +
    1.18 +status = summary + ' ' + inSection(1) + ' ';
    1.19 +try
    1.20 +{
    1.21 +  with ({foo:"bar"})
    1.22 +    throw 42;
    1.23 +}
    1.24 +catch (e)
    1.25 +{
    1.26 +  try
    1.27 +  {
    1.28 +    printStatus(foo);
    1.29 +  }
    1.30 +  catch(ee)
    1.31 +  {
    1.32 +    actual = ee.name;
    1.33 +  }
    1.34 +}
    1.35 + 
    1.36 +reportCompare(expect, actual, status);
    1.37 +
    1.38 +status = summary + ' ' + inSection(2) + ' ';
    1.39 +try
    1.40 +{
    1.41 +  with ({foo:"bar"})
    1.42 +    eval("throw 42");
    1.43 +}
    1.44 +catch (e)
    1.45 +{
    1.46 +  try
    1.47 +  {
    1.48 +    printStatus(foo);
    1.49 +  }
    1.50 +  catch(ee)
    1.51 +  {
    1.52 +    actual = ee.name;
    1.53 +  }
    1.54 +}
    1.55 + 
    1.56 +reportCompare(expect, actual, status);
    1.57 +
    1.58 +status = summary + ' ' + inSection(3) + ' ';
    1.59 +try
    1.60 +{
    1.61 +  var s = "throw 42";
    1.62 +  with ({foo:"bar"})
    1.63 +    eval(s);
    1.64 +}
    1.65 +catch (e)
    1.66 +{
    1.67 +  try
    1.68 +  {
    1.69 +    printStatus(foo);
    1.70 +  }
    1.71 +  catch(ee)
    1.72 +  {
    1.73 +    actual = ee.name;
    1.74 +  }
    1.75 +}
    1.76 + 
    1.77 +reportCompare(expect, actual, status);

mercurial