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 = 350312;
8 var summary = 'Accessing wrong stack slot with nested catch/finally';
9 var actual = '';
10 var expect = '';
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
17 function test()
18 {
19 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
23 function createPrint(obj)
24 {
25 return new Function("actual += " + obj + " + ','; " +
26 "print(" + obj + ");");
27 }
29 function createThrow(obj)
30 {
31 return new Function("throw " + obj + "; ");
32 }
35 function f(a, b, c)
36 {
37 try {
38 a();
39 } catch (e if e == null) {
40 b();
41 } finally {
42 c();
43 }
44 }
46 print('test 1');
47 expect = 'a,c,';
48 actual = '';
49 try
50 {
51 f(createPrint("'a'"), createPrint("'b'"), createPrint("'c'"));
52 }
53 catch(ex)
54 {
55 actual += 'caught ' + ex;
56 }
57 reportCompare(expect, actual, summary + ': 1');
59 print('test 2');
60 expect = 'c,caught a';
61 actual = '';
62 try
63 {
64 f(createThrow("'a'"), createPrint("'b'"), createPrint("'c'"));
65 }
66 catch(ex)
67 {
68 actual += 'caught ' + ex;
69 }
70 reportCompare(expect, actual, summary + ': 2');
72 print('test 3');
73 expect = 'b,c,';
74 actual = '';
75 try
76 {
77 f(createThrow("null"), createPrint("'b'"), createPrint("'c'"));
78 }
79 catch(ex)
80 {
81 actual += 'caught ' + ex;
82 }
83 reportCompare(expect, actual, summary + ': 3');
85 print('test 4');
86 expect = 'a,c,';
87 actual = '';
88 try
89 {
90 f(createPrint("'a'"), createThrow("'b'"), createPrint("'c'"));
91 }
92 catch(ex)
93 {
94 actual += 'caught ' + ex;
95 }
96 reportCompare(expect, actual, summary + ': 4');
98 print('test 5');
99 expect = 'c,caught b';
100 actual = '';
101 try
102 {
103 f(createThrow("null"), createThrow("'b'"), createPrint("'c'"));
104 }
105 catch(ex)
106 {
107 actual += 'caught ' + ex;
108 }
109 reportCompare(expect, actual, summary + ': 5');
111 exitFunc ('test');
112 }