Wed, 31 Dec 2014 06:09:35 +0100
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 var BUGNUMBER = 387501;
8 var summary =
9 'Array.prototype.toString|toLocaleString are generic, ' +
10 'Array.prototype.toSource is not generic';
11 var actual = '';
12 var expect = '';
15 //-----------------------------------------------------------------------------
16 test();
17 //-----------------------------------------------------------------------------
19 function test()
20 {
21 enterFunc ('test');
22 printBugNumber(BUGNUMBER);
23 printStatus (summary);
25 expect = '[object String]';
26 actual = Array.prototype.toString.call((new String('foo')));
27 assertEq(actual, expect, summary);
29 expect = 'f,o,o';
30 actual = Array.prototype.toLocaleString.call((new String('foo')));
31 assertEq(actual, expect, summary);
33 if (typeof Array.prototype.toSource != 'undefined')
34 {
35 try
36 {
37 Array.prototype.toSource.call(new String('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 }
47 reportCompare(true, true, "Tests complete");
49 exitFunc ('test');
50 }