diff options
author | trav90 <travawine@protonmail.ch> | 2018-05-12 08:19:07 -0500 |
---|---|---|
committer | trav90 <travawine@protonmail.ch> | 2018-05-12 08:19:07 -0500 |
commit | 536562284f1ffe459f432f5810d59dcb6eadb8cc (patch) | |
tree | ab4e66954e9584598238883c884892a2e043ac2c | |
parent | 8e08b8cef22be82dfc6f62bf8531ba3da097ef9b (diff) | |
download | UXP-536562284f1ffe459f432f5810d59dcb6eadb8cc.tar UXP-536562284f1ffe459f432f5810d59dcb6eadb8cc.tar.gz UXP-536562284f1ffe459f432f5810d59dcb6eadb8cc.tar.lz UXP-536562284f1ffe459f432f5810d59dcb6eadb8cc.tar.xz UXP-536562284f1ffe459f432f5810d59dcb6eadb8cc.zip |
Make safebrowsing optional at build time - Part 3: toolkit/
-rw-r--r-- | toolkit/components/build/nsToolkitCompsModule.cpp | 10 | ||||
-rw-r--r-- | toolkit/components/downloads/moz.build | 8 | ||||
-rw-r--r-- | toolkit/components/jsdownloads/src/DownloadIntegration.jsm | 7 | ||||
-rw-r--r-- | toolkit/components/moz.build | 4 | ||||
-rw-r--r-- | toolkit/modules/AppConstants.jsm | 7 |
5 files changed, 33 insertions, 3 deletions
diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp index 22bb434a0..f81e35f23 100644 --- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -26,11 +26,13 @@ #include "nsTypeAheadFind.h" +#ifdef MOZ_URL_CLASSIFIER #include "ApplicationReputation.h" #include "nsUrlClassifierDBService.h" #include "nsUrlClassifierStreamUpdater.h" #include "nsUrlClassifierUtils.h" #include "nsUrlClassifierPrefixSet.h" +#endif #include "nsBrowserStatusFilter.h" #include "mozilla/FinalizationWitnessService.h" @@ -91,6 +93,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind) +#ifdef MOZ_URL_CLASSIFIER NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService, ApplicationReputationService::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet) @@ -115,6 +118,7 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID, return rv; } +#endif NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter) #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) @@ -148,11 +152,13 @@ NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID); NS_DEFINE_NAMED_CID(NS_DOWNLOAD_CID); NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID); +#ifdef MOZ_URL_CLASSIFIER NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID); NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID); NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID); NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID); +#endif NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID); #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID); @@ -184,11 +190,13 @@ static const Module::CIDEntry kToolkitCIDs[] = { { &kNS_DOWNLOAD_CID, false, nullptr, nsDownloadProxyConstructor }, { &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor }, { &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor }, +#ifdef MOZ_URL_CLASSIFIER { &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor }, { &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor }, { &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor }, { &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor }, { &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor }, +#endif { &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor }, #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) { &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor }, @@ -221,12 +229,14 @@ static const Module::ContractIDEntry kToolkitContracts[] = { { NS_DOWNLOADPLATFORM_CONTRACTID, &kNS_DOWNLOADPLATFORM_CID }, { NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID }, { NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID }, +#ifdef MOZ_URL_CLASSIFIER { NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID }, { NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID }, { NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID }, { NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID }, { NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID, &kNS_URLCLASSIFIERSTREAMUPDATER_CID }, { NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID }, +#endif { NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID }, #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) { NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID }, diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build index 477db0bd6..20394a70d 100644 --- a/toolkit/components/downloads/moz.build +++ b/toolkit/components/downloads/moz.build @@ -32,8 +32,6 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'downloads' UNIFIED_SOURCES += [ - 'ApplicationReputation.cpp', - 'chromium/chrome/common/safe_browsing/csd.pb.cc', 'nsDownloadManager.cpp' ] @@ -42,6 +40,12 @@ SOURCES += [ 'SQLFunctions.cpp', ] +if CONFIG['MOZ_URL_CLASSIFIER']: + UNIFIED_SOURCES += [ + 'ApplicationReputation.cpp', + 'chromium/chrome/common/safe_browsing/csd.pb.cc' + ] + if CONFIG['OS_ARCH'] == 'WINNT': # Can't build unified because we need CreateEvent which some IPC code # included in LoadContext ends up undefining. diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 4069bca74..c24c5d631 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -475,6 +475,12 @@ this.DownloadIntegration = { * } */ shouldBlockForReputationCheck(aDownload) { +#ifndef MOZ_URL_CLASSIFIER + return Promise.resolve({ + shouldBlock: false, + verdict: "", + }); +#else let hash; let sigInfo; let channelRedirects; @@ -515,6 +521,7 @@ this.DownloadIntegration = { }); }); return deferred.promise; +#endif }, #ifdef XP_WIN diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build index e0b412428..c34c1f18d 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -60,7 +60,6 @@ DIRS += [ 'tooltiptext', 'typeaheadfind', 'utils', - 'url-classifier', 'urlformatter', 'viewconfig', 'workerloader', @@ -93,6 +92,9 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: if CONFIG['MOZ_TOOLKIT_SEARCH']: DIRS += ['search'] +if CONFIG['MOZ_URL_CLASSIFIER']: + DIRS += ['url-classifier'] + DIRS += ['captivedetect'] if CONFIG['OS_TARGET'] != 'Android': diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index c500b21e8..c2abc939c 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -81,6 +81,13 @@ this.AppConstants = Object.freeze({ false, #endif +MOZ_SAFE_BROWSING: +#ifdef MOZ_SAFE_BROWSING + true, +#else + false, +#endif + MOZ_TELEMETRY_REPORTING: #ifdef MOZ_TELEMETRY_REPORTING true, |