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 load(libdir + "asserts.js");
3 var valid_strict_funs = [
4 // directive ends on next line
5 function () {
6 "use strict"
7 ;
8 },
9 function () {
10 "use strict"
11 },
12 // directive ends on same line
13 function () { "use strict"; },
14 function () { "use strict" },
15 ];
17 for (var f of valid_strict_funs) {
18 assertThrowsInstanceOf(function() { f.caller }, TypeError);
19 }
22 var binary_ops = [
23 "||", "&&",
24 "|", "^", "&",
25 "==", "!=", "===", "!==",
26 "<", "<=", ">", ">=", "in", "instanceof",
27 "<<", ">>", ">>>",
28 "+", "-",
29 "*", "/", "%",
30 ];
32 var invalid_strict_funs = [
33 function () {
34 "use strict"
35 , "not";
36 },
37 function () {
38 "use strict"
39 ? 1 : 0;
40 },
41 function () {
42 "use strict"
43 .length;
44 },
45 function () {
46 "use strict"
47 [0];
48 },
49 function () {
50 "use strict"
51 ();
52 },
53 ...([]),
54 ...[Function("'use strict'\n " + op + " 'not'") for (op of binary_ops)],
55 ];
57 for (var f of invalid_strict_funs) {
58 f.caller;
59 }
62 var assignment_ops = [
63 "=", "+=", "-=",
64 "|=", "^=", "&=",
65 "<<=", ">>=", ">>>=",
66 "*=", "/=", "%=",
67 ];
69 var invalid_strict_funs_referror = [
70 ...[("'use strict'\n " + op + " 'not'") for (op of assignment_ops)],
71 ];
73 // assignment with string literal as LHS is an early error, therefore we
74 // can only test for ReferenceError
75 for (var f of invalid_strict_funs_referror) {
76 assertThrowsInstanceOf(function() { Function(f) }, ReferenceError);
77 }