toolkit/components/build/nsToolkitCompsModule.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.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "mozilla/ModuleUtils.h"
michael@0 6 #include "nsAppStartup.h"
michael@0 7 #include "nsUserInfo.h"
michael@0 8 #include "nsToolkitCompsCID.h"
michael@0 9 #include "nsFindService.h"
michael@0 10 #if defined(USE_MOZ_UPDATER)
michael@0 11 #include "nsUpdateDriver.h"
michael@0 12 #endif
michael@0 13
michael@0 14 #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
michael@0 15 #include "nsParentalControlsServiceWin.h"
michael@0 16 #endif
michael@0 17
michael@0 18 #include "nsAlertsService.h"
michael@0 19
michael@0 20 #include "nsDownloadManager.h"
michael@0 21 #include "DownloadPlatform.h"
michael@0 22 #include "nsDownloadProxy.h"
michael@0 23 #include "nsCharsetMenu.h"
michael@0 24 #include "rdf.h"
michael@0 25
michael@0 26 #include "nsTypeAheadFind.h"
michael@0 27
michael@0 28 #ifdef MOZ_URL_CLASSIFIER
michael@0 29 #include "ApplicationReputation.h"
michael@0 30 #include "nsUrlClassifierDBService.h"
michael@0 31 #include "nsUrlClassifierStreamUpdater.h"
michael@0 32 #include "nsUrlClassifierUtils.h"
michael@0 33 #include "nsUrlClassifierPrefixSet.h"
michael@0 34 #endif
michael@0 35
michael@0 36 #include "nsBrowserStatusFilter.h"
michael@0 37 #include "mozilla/FinalizationWitnessService.h"
michael@0 38 #include "mozilla/NativeOSFileInternals.h"
michael@0 39
michael@0 40 using namespace mozilla;
michael@0 41
michael@0 42 /////////////////////////////////////////////////////////////////////////////
michael@0 43
michael@0 44 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAppStartup, Init)
michael@0 45 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo)
michael@0 46 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFindService)
michael@0 47
michael@0 48 #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
michael@0 49 NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsServiceWin)
michael@0 50 #endif
michael@0 51
michael@0 52 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService)
michael@0 53
michael@0 54 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDownloadManager,
michael@0 55 nsDownloadManager::GetSingleton)
michael@0 56 NS_GENERIC_FACTORY_CONSTRUCTOR(DownloadPlatform)
michael@0 57 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy)
michael@0 58
michael@0 59 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind)
michael@0 60
michael@0 61 #ifdef MOZ_URL_CLASSIFIER
michael@0 62 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService,
michael@0 63 ApplicationReputationService::GetSingleton)
michael@0 64 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet)
michael@0 65 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierStreamUpdater)
michael@0 66 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUrlClassifierUtils, Init)
michael@0 67
michael@0 68 static nsresult
michael@0 69 nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
michael@0 70 void **aResult)
michael@0 71 {
michael@0 72 nsresult rv;
michael@0 73 NS_ENSURE_ARG_POINTER(aResult);
michael@0 74 NS_ENSURE_NO_AGGREGATION(aOuter);
michael@0 75
michael@0 76 nsUrlClassifierDBService *inst = nsUrlClassifierDBService::GetInstance(&rv);
michael@0 77 if (nullptr == inst) {
michael@0 78 return rv;
michael@0 79 }
michael@0 80 /* NS_ADDREF(inst); */
michael@0 81 rv = inst->QueryInterface(aIID, aResult);
michael@0 82 NS_RELEASE(inst);
michael@0 83
michael@0 84 return rv;
michael@0 85 }
michael@0 86 #endif
michael@0 87
michael@0 88 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter)
michael@0 89 #if defined(USE_MOZ_UPDATER)
michael@0 90 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor)
michael@0 91 #endif
michael@0 92 NS_GENERIC_FACTORY_CONSTRUCTOR(FinalizationWitnessService)
michael@0 93 NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService)
michael@0 94
michael@0 95 NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
michael@0 96 NS_DEFINE_NAMED_CID(NS_USERINFO_CID);
michael@0 97 NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID);
michael@0 98 #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
michael@0 99 NS_DEFINE_NAMED_CID(NS_PARENTALCONTROLSSERVICE_CID);
michael@0 100 #endif
michael@0 101 NS_DEFINE_NAMED_CID(NS_DOWNLOADMANAGER_CID);
michael@0 102 NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID);
michael@0 103 NS_DEFINE_NAMED_CID(NS_DOWNLOAD_CID);
michael@0 104 NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID);
michael@0 105 NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID);
michael@0 106 #ifdef MOZ_URL_CLASSIFIER
michael@0 107 NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID);
michael@0 108 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID);
michael@0 109 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID);
michael@0 110 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
michael@0 111 NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID);
michael@0 112 #endif
michael@0 113 NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID);
michael@0 114 NS_DEFINE_NAMED_CID(NS_CHARSETMENU_CID);
michael@0 115 #if defined(USE_MOZ_UPDATER)
michael@0 116 NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
michael@0 117 #endif
michael@0 118 NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID);
michael@0 119 NS_DEFINE_NAMED_CID(NATIVE_OSFILE_INTERNALS_SERVICE_CID);
michael@0 120
michael@0 121 static const Module::CIDEntry kToolkitCIDs[] = {
michael@0 122 { &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor },
michael@0 123 { &kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor },
michael@0 124 { &kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor },
michael@0 125 #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
michael@0 126 { &kNS_PARENTALCONTROLSSERVICE_CID, false, nullptr, nsParentalControlsServiceWinConstructor },
michael@0 127 #endif
michael@0 128 { &kNS_DOWNLOADMANAGER_CID, false, nullptr, nsDownloadManagerConstructor },
michael@0 129 { &kNS_DOWNLOADPLATFORM_CID, false, nullptr, DownloadPlatformConstructor },
michael@0 130 { &kNS_DOWNLOAD_CID, false, nullptr, nsDownloadProxyConstructor },
michael@0 131 { &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor },
michael@0 132 { &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor },
michael@0 133 #ifdef MOZ_URL_CLASSIFIER
michael@0 134 { &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor },
michael@0 135 { &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor },
michael@0 136 { &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor },
michael@0 137 { &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor },
michael@0 138 { &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
michael@0 139 #endif
michael@0 140 { &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
michael@0 141 { &kNS_CHARSETMENU_CID, false, nullptr, NS_NewCharsetMenu },
michael@0 142 #if defined(USE_MOZ_UPDATER)
michael@0 143 { &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
michael@0 144 #endif
michael@0 145 { &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor },
michael@0 146 { &kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr, NativeOSFileInternalsServiceConstructor },
michael@0 147 { nullptr }
michael@0 148 };
michael@0 149
michael@0 150 static const Module::ContractIDEntry kToolkitContracts[] = {
michael@0 151 { NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID },
michael@0 152 { NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID },
michael@0 153 { NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID },
michael@0 154 #if defined(XP_WIN) && !defined(MOZ_DISABLE_PARENTAL_CONTROLS)
michael@0 155 { NS_PARENTALCONTROLSSERVICE_CONTRACTID, &kNS_PARENTALCONTROLSSERVICE_CID },
michael@0 156 #endif
michael@0 157 { NS_DOWNLOADMANAGER_CONTRACTID, &kNS_DOWNLOADMANAGER_CID },
michael@0 158 { NS_DOWNLOADPLATFORM_CONTRACTID, &kNS_DOWNLOADPLATFORM_CID },
michael@0 159 { NS_TRANSFER_CONTRACTID, &kNS_DOWNLOAD_CID },
michael@0 160 { NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID },
michael@0 161 { NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID },
michael@0 162 #ifdef MOZ_URL_CLASSIFIER
michael@0 163 { NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID },
michael@0 164 { NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID },
michael@0 165 { NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
michael@0 166 { NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
michael@0 167 { NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID, &kNS_URLCLASSIFIERSTREAMUPDATER_CID },
michael@0 168 { NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID },
michael@0 169 #endif
michael@0 170 { NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID },
michael@0 171 { NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID, &kNS_CHARSETMENU_CID },
michael@0 172 #if defined(USE_MOZ_UPDATER)
michael@0 173 { NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID },
michael@0 174 #endif
michael@0 175 { FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID },
michael@0 176 { NATIVE_OSFILE_INTERNALS_SERVICE_CONTRACTID, &kNATIVE_OSFILE_INTERNALS_SERVICE_CID },
michael@0 177 { nullptr }
michael@0 178 };
michael@0 179
michael@0 180 static const Module kToolkitModule = {
michael@0 181 Module::kVersion,
michael@0 182 kToolkitCIDs,
michael@0 183 kToolkitContracts
michael@0 184 };
michael@0 185
michael@0 186 NSMODULE_DEFN(nsToolkitCompsModule) = &kToolkitModule;

mercurial