tor-browser

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

regress-114493.js (1935B)


      1 /* -*- 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 *
      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 = '';
     36 
     37 
     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();
     51 
     52 
     53 
     54 //-----------------------------------------------------------------------------
     55 test();
     56 //-----------------------------------------------------------------------------
     57 
     58 
     59 function addThis()
     60 {
     61  statusitems[UBound] = status;
     62  actualvalues[UBound] = actual;
     63  expectedvalues[UBound] = expect;
     64  UBound++;
     65 }
     66 
     67 
     68 function test()
     69 {
     70  printBugNumber(BUGNUMBER);
     71  printStatus (summary);
     72 
     73  for (var i = 0; i < UBound; i++)
     74  {
     75    reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
     76  }
     77 }