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 = 341956;
8 var summary = 'GC Hazards in jsarray.c - unshift';
9 var actual = 'No Crash';
10 var expect = 'No Crash';
12 //-----------------------------------------------------------------------------
13 test();
14 //-----------------------------------------------------------------------------
16 function test()
17 {
18 enterFunc ('test');
19 printBugNumber(BUGNUMBER);
20 printStatus (summary);
22 var N = 0xFFFFFFFF;
24 var a = [];
25 a[N - 1] = 1;
26 a.__defineGetter__(N - 1, function() {
27 var tmp = [];
28 tmp[N - 2] = 0;
29 if (typeof gc == 'function')
30 gc();
31 for (var i = 0; i != 50000; ++i) {
32 var tmp = 1 / 3;
33 tmp /= 10;
34 }
35 for (var i = 0; i != 1000; ++i) {
36 // Make string with 11 characters that would take
37 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
38 // malloc will ovewrite just freed atoms.
39 var tmp2 = Array(12).join(' ');
40 }
41 return 10;
42 });
45 // The following always-throw getter is to stop unshift from doing
46 // 2^32 iterations.
47 var toStop = "stringToStop";
48 a[N - 3] = 0;
49 a.__defineGetter__(N - 3, function() { throw toStop; });
51 var good = false;
53 try {
54 a.unshift(1);
55 } catch (e) {
56 if (e === toStop)
57 good = true;
58 }
60 expect = true;
61 actual = good;
63 reportCompare(expect, actual, summary);
65 print('Done');
67 exitFunc ('test');
68 }