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 *
8 * Date: 15 July 2002
9 * SUMMARY: Testing for SyntaxError on usage of '\' in identifiers
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=157509
11 *
12 */
13 //-----------------------------------------------------------------------------
14 var UBound = 0;
15 var BUGNUMBER = 157509;
16 var summary = "Testing for SyntaxError on usage of '\\' in identifiers";
17 var TEST_PASSED = 'SyntaxError';
18 var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!';
19 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
20 var status = '';
21 var statusitems = [];
22 var actual = '';
23 var actualvalues = [];
24 var expect= '';
25 var expectedvalues = [];
28 status = inSection(1);
29 expect = TEST_PASSED;
30 actual = TEST_FAILED_BADLY;
31 /*
32 * OK, this should generate a SyntaxError
33 */
34 try
35 {
36 eval('var a\\1 = 0;');
37 }
38 catch(e)
39 {
40 if (e instanceof SyntaxError)
41 actual = TEST_PASSED;
42 else
43 actual = TEST_FAILED;
44 }
45 addThis();
50 //-----------------------------------------------------------------------------
51 test();
52 //-----------------------------------------------------------------------------
56 function addThis()
57 {
58 statusitems[UBound] = status;
59 actualvalues[UBound] = actual;
60 expectedvalues[UBound] = expect;
61 UBound++;
62 }
65 function test()
66 {
67 enterFunc('test');
68 printBugNumber(BUGNUMBER);
69 printStatus(summary);
71 for (var i=0; i<UBound; i++)
72 {
73 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
74 }
76 exitFunc ('test');
77 }