js/src/tests/js1_5/Regress/regress-114491.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
     6 /*
     7  *
     8  * Date:    10 December 2001
     9  * SUMMARY: Regression test for bug 114491
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=114491
    11  *
    12  * Rhino crashed on this code. It should produce a syntax error, not a crash.
    13  * Using the () operator after a function STATEMENT is incorrect syntax.
    14  * Rhino correctly caught the error when there was no |if (true)|.
    15  * With the |if (true)|, however, Rhino crashed -
    16  *
    17  */
    18 //-----------------------------------------------------------------------------
    19 var UBound = 0;
    20 var BUGNUMBER = 114491;
    21 var summary = 'Regression test for bug 114491';
    22 var status = '';
    23 var statusitems = [];
    24 var actual = '';
    25 var actualvalues = [];
    26 var expect= '';
    27 var expectedvalues = [];
    30 status = inSection(1);
    31 actual = 'Program execution did NOT fall into catch-block';
    32 expect = 'Program execution fell into into catch-block';
    33 try
    34 {
    35   var sEval = 'if (true) function f(){}()';
    36   eval(sEval);
    37 }
    38 catch(e)
    39 {
    40   actual = expect;
    41 }
    42 addThis();
    46 //-----------------------------------------------------------------------------
    47 test();
    48 //-----------------------------------------------------------------------------
    51 function addThis()
    52 {
    53   statusitems[UBound] = status;
    54   actualvalues[UBound] = actual;
    55   expectedvalues[UBound] = expect;
    56   UBound++;
    57 }
    60 function test()
    61 {
    62   enterFunc ('test');
    63   printBugNumber(BUGNUMBER);
    64   printStatus (summary);
    66   for (var i = 0; i < UBound; i++)
    67   {
    68     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    69   }
    71   exitFunc ('test');
    72 }

mercurial