modules/libpref/src/nsPrefsFactory.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 #include "mozilla/ModuleUtils.h"
     7 #include "mozilla/Preferences.h"
     8 #include "nsPrefBranch.h"
     9 #include "prefapi.h"
    11 using namespace mozilla;
    13 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
    14                                          Preferences::GetInstanceForService)
    15 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
    16 NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
    18 static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
    19 static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
    20 static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
    22 static mozilla::Module::CIDEntry kPrefCIDs[] = {
    23   { &kPrefServiceCID, true, nullptr, PreferencesConstructor },
    24   { &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor },
    25   { &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
    26   { nullptr }
    27 };
    29 static mozilla::Module::ContractIDEntry kPrefContracts[] = {
    30   { NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID },
    31   { NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID },
    32   { NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
    33   // compatibility for extension that uses old service
    34   { "@mozilla.org/preferences;1", &kPrefServiceCID },
    35   { nullptr }
    36 };
    38 static void
    39 UnloadPrefsModule()
    40 {
    41   Preferences::Shutdown();
    42 }
    44 static const mozilla::Module kPrefModule = {
    45   mozilla::Module::kVersion,
    46   kPrefCIDs,
    47   kPrefContracts,
    48   nullptr,
    49   nullptr,
    50   nullptr,
    51   UnloadPrefsModule
    52 };
    54 NSMODULE_DEFN(nsPrefModule) = &kPrefModule;

mercurial