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 = 394709;
8 var summary = 'Do not leak with object.watch and closure';
9 var actual = 'No Leak';
10 var expect = 'No Leak';
12 if (typeof countHeap == 'undefined')
13 {
14 countHeap = function () {
15 print('This test requires countHeap which is not supported');
16 return 0;
17 };
18 }
20 //-----------------------------------------------------------------------------
21 test();
22 //-----------------------------------------------------------------------------
24 function test()
25 {
26 enterFunc ('test');
27 printBugNumber(BUGNUMBER);
28 printStatus (summary);
30 // Ensure that we flush all values so that gc() collects all objects that
31 // the user cannot reach from JS.
32 eval();
34 runtest();
35 gc();
36 var count1 = countHeap();
37 runtest();
38 gc();
39 var count2 = countHeap();
40 runtest();
41 gc();
42 var count3 = countHeap();
43 /* Try to be tolerant of conservative GC noise: we want a steady leak. */
44 if (count1 < count2 && count2 < count3)
45 throw "A leaky watch point is detected";
47 function runtest () {
48 var obj = { b: 0 };
49 obj.watch('b', watcher);
51 function watcher(id, old, value) {
52 ++obj.n;
53 return value;
54 }
55 }
57 reportCompare(expect, actual, summary);
59 exitFunc ('test');
60 }