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: 21 February 2003
9 * SUMMARY: Testing eval statements containing conditional function expressions
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=194364
12 *
13 */
14 //-----------------------------------------------------------------------------
15 var UBound = 0;
16 var BUGNUMBER = 194364;
17 var summary = 'Testing eval statements with conditional function expressions';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
25 /*
26 From ECMA-262 Edition 3, 12.4:
28 12.4 Expression Statement
30 Syntax
31 ExpressionStatement : [lookahead not in {{, function}] Expression ;
33 Note that an ExpressionStatement cannot start with an opening curly brace
34 because that might make it ambiguous with a Block. Also, an ExpressionStatement
35 cannot start with the function keyword because that might make it ambiguous with
36 a FunctionDeclaration.
37 */
39 status = inSection(1);
40 actual = eval('(function() {}); 1');
41 expect = 1;
42 addThis();
44 status = inSection(2);
45 actual = eval('(function f() {}); 2');
46 expect = 2;
47 addThis();
49 status = inSection(3);
50 actual = eval('if (true) (function() {}); 3');
51 expect = 3;
52 addThis();
54 status = inSection(4);
55 actual = eval('if (true) (function f() {}); 4');
56 expect = 4;
57 addThis();
59 status = inSection(5);
60 actual = eval('if (false) (function() {}); 5');
61 expect = 5;
62 addThis();
64 status = inSection(6);
65 actual = eval('if (false) (function f() {}); 6');
66 expect = 6;
67 addThis();
69 status = inSection(7);
70 actual = eval('switch(true) { case true: (function() {}) }; 7');
71 expect = 7;
72 addThis();
74 status = inSection(8);
75 actual = eval('switch(true) { case true: (function f() {}) }; 8');
76 expect = 8;
77 addThis();
79 status = inSection(9);
80 actual = eval('switch(false) { case false: (function() {}) }; 9');
81 expect = 9;
82 addThis();
84 status = inSection(10);
85 actual = eval('switch(false) { case false: (function f() {}) }; 10');
86 expect = 10;
87 addThis();
91 //-----------------------------------------------------------------------------
92 test();
93 //-----------------------------------------------------------------------------
97 function addThis()
98 {
99 statusitems[UBound] = status;
100 actualvalues[UBound] = actual;
101 expectedvalues[UBound] = expect;
102 UBound++;
103 }
106 function test()
107 {
108 enterFunc('test');
109 printBugNumber(BUGNUMBER);
110 printStatus(summary);
112 for (var i=0; i<UBound; i++)
113 {
114 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
115 }
117 exitFunc ('test');
118 }