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: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
9 var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
10 getService(Ci.nsINavHistoryService);
11 var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
12 getService(Ci.nsINavBookmarksService);
14 /**
15 * The callback object for runInBatchMode.
16 *
17 * @param aService
18 * Takes a reference to the history service or the bookmark service.
19 * This determines which service should be called when calling the second
20 * runInBatchMode the second time.
21 */
22 function callback(aService)
23 {
24 this.callCount = 0;
25 this.service = aService;
26 }
27 callback.prototype = {
28 //////////////////////////////////////////////////////////////////////////////
29 //// nsINavHistoryBatchCallback
31 runBatched: function(aUserData)
32 {
33 this.callCount++;
35 if (this.callCount == 1) {
36 // We want to call run in batched once more.
37 this.service.runInBatchMode(this, null);
38 return;
39 }
41 do_check_eq(this.callCount, 2);
42 do_test_finished();
43 },
45 //////////////////////////////////////////////////////////////////////////////
46 //// nsISupports
48 QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryBatchCallback])
49 };
51 function run_test() {
52 // checking the history service
53 do_test_pending();
54 hs.runInBatchMode(new callback(hs), null);
56 // checking the bookmark service
57 do_test_pending();
58 bs.runInBatchMode(new callback(bs), null);
59 }