Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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 = 402386;
8 var summary = 'Automatic Semicolon insertion in postfix expressions';
9 var actual = '';
10 var expect = '';
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
17 function test()
18 {
19 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
23 var expr;
24 var code;
26 // LeftHandSideExpression [no LineTerminator here] ++
28 code = 'expr ++';
29 expr = 0;
30 expect = 1;
32 try
33 {
34 eval(code);
35 actual = expr;
36 }
37 catch(ex)
38 {
39 actual = ex + '';
40 }
41 reportCompare(expect, actual, summary + ': ' + code);
43 code = 'expr\n++';
44 expr = 0;
45 expect = 'SyntaxError: syntax error';
47 try
48 {
49 eval(code);
50 actual = expr;
51 }
52 catch(ex)
53 {
54 actual = ex + '';
55 }
56 reportCompare(expect, actual, summary + ': ' + code);
58 // LeftHandSideExpression [no LineTerminator here] --
60 code = 'expr --';
61 expr = 0;
62 expect = -1;
64 try
65 {
66 eval(code);
67 actual = expr;
68 }
69 catch(ex)
70 {
71 actual = ex + '';
72 }
73 reportCompare(expect, actual, summary + ': ' + code);
75 code = 'expr\n--';
76 expr = 0;
77 expect = 'SyntaxError: syntax error';
79 try
80 {
81 eval(code);
82 actual = expr;
83 }
84 catch(ex)
85 {
86 actual = ex + '';
87 }
88 reportCompare(expect, actual, summary + ': ' + code);
90 //
92 var x = 1;
93 var y = 1;
94 code = '(x\n)-- y';
95 expect = 'SyntaxError: missing ; before statement';
97 try
98 {
99 eval(code);
100 actual = expr;
101 }
102 catch(ex)
103 {
104 actual = ex + '';
105 }
106 reportCompare(expect, actual, summary + ': ' + code);
108 code = '(x)-- y';
109 expect = 'SyntaxError: missing ; before statement';
111 try
112 {
113 eval(code);
114 actual = expr;
115 }
116 catch(ex)
117 {
118 actual = ex + '';
119 }
120 reportCompare(expect, actual, summary + ': ' + code);
122 exitFunc ('test');
123 }