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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include "nsIServiceManager.h"
8 // Gee this seems simple! It's for testing for memory leaks with Purify.
10 void main(int argc, char* argv[])
11 {
12 nsresult rv;
13 nsIServiceManager* servMgr;
14 rv = NS_InitXPCOM2(&servMgr, nullptr, nullptr);
15 NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
17 // try loading a component and releasing it to see if it leaks
18 if (argc > 1 && argv[1] != nullptr) {
19 char* cidStr = argv[1];
20 nsISupports* obj = nullptr;
21 if (cidStr[0] == '{') {
22 nsCID cid;
23 cid.Parse(cidStr);
24 rv = CallCreateInstance(cid, &obj);
25 }
26 else {
27 // contractID case:
28 rv = CallCreateInstance(cidStr, &obj);
29 }
30 if (NS_SUCCEEDED(rv)) {
31 printf("Successfully created %s\n", cidStr);
32 NS_RELEASE(obj);
33 }
34 else {
35 printf("Failed to create %s (%x)\n", cidStr, rv);
36 }
37 }
39 rv = NS_ShutdownXPCOM(servMgr);
40 NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
41 }