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 - reverse';
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;
23 var a = [];
24 a[N - 1] = 0;
26 var expected = "GETTER RESULT";
28 a.__defineGetter__(N - 1, function() {
29 delete a[N - 1];
30 var tmp = [];
31 tmp[N - 2] = 1;
33 if (typeof gc == 'function')
34 gc();
35 for (var i = 0; i != 50000; ++i) {
36 var tmp = 1 / 3;
37 tmp /= 10;
38 }
39 for (var i = 0; i != 1000; ++i) {
40 // Make string with 11 characters that would take
41 // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually
42 // malloc will ovewrite just freed atoms.
43 var tmp2 = Array(12).join(' ');
44 }
45 return expected;
46 });
48 // The following always-throw getter is to stop unshift from doing
49 // 2^32 iterations.
50 var toStop = "stringToStop";
51 a[N - 3] = 0;
52 a.__defineGetter__(N - 3, function() { throw toStop; });
55 var good = false;
57 try {
58 a.reverse();
59 } catch (e) {
60 if (e === toStop)
61 good = true;
62 }
64 expect = true;
65 actual = good;
67 reportCompare(expect, actual, summary);
69 print('Done');
71 exitFunc ('test');
72 }