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 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/licenses/publicdomain/
4 var gTestfile = 'destructure-accessor.js';
5 //-----------------------------------------------------------------------------
6 var BUGNUMBER = 536472;
7 var summary =
8 'ES5: { get x(v) { } } and { set x(v, v2) { } } should be syntax errors';
10 print(BUGNUMBER + ": " + summary);
12 //-----------------------------------------------------------------------------
14 function expectOk(s)
15 {
16 try
17 {
18 eval(s);
19 return;
20 }
21 catch (e)
22 {
23 assertEq(true, false,
24 "expected no error parsing '" + "', got : " + e);
25 }
26 }
28 function expectSyntaxError(s)
29 {
30 try
31 {
32 eval(s);
33 throw new Error("no error thrown");
34 }
35 catch (e)
36 {
37 assertEq(e instanceof SyntaxError, true,
38 "expected syntax error parsing '" + s + "', got: " + e);
39 }
40 }
42 expectSyntaxError("({ get x([]) { } })");
43 expectSyntaxError("({ get x({}) { } })");
44 expectSyntaxError("({ get x(a, []) { } })");
45 expectSyntaxError("({ get x(a, {}) { } })");
46 expectSyntaxError("({ get x([], a) { } })");
47 expectSyntaxError("({ get x({}, a) { } })");
48 expectSyntaxError("({ get x([], a, []) { } })");
49 expectSyntaxError("({ get x([], a, {}) { } })");
50 expectSyntaxError("({ get x({}, a, []) { } })");
51 expectSyntaxError("({ get x({}, a, {}) { } })");
53 expectOk("({ get x() { } })");
56 expectSyntaxError("({ set x() { } })");
57 expectSyntaxError("({ set x(a, []) { } })");
58 expectSyntaxError("({ set x(a, b, c) { } })");
60 expectOk("({ set x([]) { } })");
61 expectOk("({ set x({}) { } })");
62 expectOk("({ set x([a]) { } })");
63 expectOk("({ set x([a, b]) { } })");
64 expectOk("({ set x([a,]) { } })");
65 expectOk("({ set x([a, b,]) { } })");
66 expectOk("({ set x([, b]) { } })");
67 expectOk("({ set x([, b,]) { } })");
68 expectOk("({ set x([, b, c]) { } })");
69 expectOk("({ set x([, b, c,]) { } })");
70 expectOk("({ set x({ a: a }) { } })");
71 expectOk("({ set x({ a: a, b: b }) { } })");
73 //-----------------------------------------------------------------------------
75 reportCompare(true, true);