js/src/tests/js1_5/Regress/regress-114493.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 114493
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=114493
    11  *
    12  * Rhino crashed on this code. It should produce a syntax error, not a crash.
    13  * Note that "3"[5] === undefined, and Rhino correctly gave an error if you
    14  * tried to use the call operator on |undefined|:
    15  *
    16  *      js> undefined();
    17  *      js: TypeError: undefined is not a function.
    18  *
    19  * However, Rhino CRASHED if you tried to do "3"[5]().
    20  *
    21  * Rhino would NOT crash if you tried "3"[0]() or "3"[5]. Only array indices
    22  * that were out of bounds, followed by the call operator, would crash.
    23  *
    24  */
    25 //-----------------------------------------------------------------------------
    26 var UBound = 0;
    27 var BUGNUMBER = 114493;
    28 var summary = 'Regression test for bug 114493';
    29 var status = '';
    30 var statusitems = [];
    31 var actual = '';
    32 var actualvalues = [];
    33 var expect= '';
    34 var expectedvalues = [];
    35 var sEval = '';
    38 status = inSection(1);
    39 actual = 'Program execution did NOT fall into catch-block';
    40 expect = 'Program execution fell into into catch-block';
    41 try
    42 {
    43   sEval = '"3"[5]()';
    44   eval(sEval);
    45 }
    46 catch(e)
    47 {
    48   actual = expect;
    49 }
    50 addThis();
    54 //-----------------------------------------------------------------------------
    55 test();
    56 //-----------------------------------------------------------------------------
    59 function addThis()
    60 {
    61   statusitems[UBound] = status;
    62   actualvalues[UBound] = actual;
    63   expectedvalues[UBound] = expect;
    64   UBound++;
    65 }
    68 function test()
    69 {
    70   enterFunc ('test');
    71   printBugNumber(BUGNUMBER);
    72   printStatus (summary);
    74   for (var i = 0; i < UBound; i++)
    75   {
    76     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    77   }
    79   exitFunc ('test');
    80 }

mercurial