tor-browser

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

regress-387501.js (1423B)


      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 var BUGNUMBER = 387501;
      8 var summary =
      9  'Array.prototype.toString|toLocaleString|toSource are generic';
     10 var actual = '';
     11 var expect = '';
     12 
     13 
     14 //-----------------------------------------------------------------------------
     15 test();
     16 //-----------------------------------------------------------------------------
     17 
     18 function test()
     19 {
     20  printBugNumber(BUGNUMBER);
     21  printStatus (summary);
     22 
     23  expect = '[object String]';
     24  actual = Array.prototype.toString.call((new String('foo')));
     25  assertEq(actual, expect, summary);
     26 
     27  expect = 'f,o,o';
     28  actual = Array.prototype.toLocaleString.call((new String('foo')));
     29  assertEq(actual, expect, summary);
     30 
     31  if (typeof Array.prototype.toSource != 'undefined')
     32  {
     33    assertEq('["f", "o", "o"]', Array.prototype.toSource.call(new String('foo')));
     34 
     35    try
     36    {
     37      Array.prototype.toSource.call('foo');
     38      throw new Error("didn't throw");
     39    }
     40    catch(ex)
     41    {
     42      assertEq(ex instanceof TypeError, true,
     43               "wrong error thrown: expected TypeError, got " + ex);
     44    }
     45  }
     46 
     47  reportCompare(true, true, "Tests complete");
     48 }