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 // Turn on strict mode and warnings-as-errors mode.
2 if (options().split().indexOf('strict') == -1)
3 options('strict');
4 if (options().split().indexOf('werror') == -1)
5 options('werror');
7 function expectSyntaxError(stmt) {
8 print(stmt);
9 var result = 'no error';
10 try {
11 Function(stmt);
12 } catch (exc) {
13 result = exc.constructor.name;
14 }
15 assertEq(result, 'SyntaxError');
16 }
18 function test(expr) {
19 // Without extra parentheses, expect an error.
20 expectSyntaxError('if (' + expr + ') {};');
22 // Extra parentheses silence the warning/error.
23 Function('if ((' + expr + ')) {};');
24 }
26 // Overparenthesized assignment in a condition should not be a strict error.
27 test('a = 0');
28 test('a = (f(), g)');
29 test('a = b || c > d');
30 expectSyntaxError('if (a == 0);');
31 reportCompare('passed', 'passed', 'Overparenthesized assignment in a condition should not be a strict error.');