summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-16 17:11:17 +0200
committerGitHub <noreply@github.com>2018-05-16 17:11:17 +0200
commitb702d7d32a9edec41cd2dad81dcf39107c1c5ddc (patch)
tree84bd9a32203822c02fc8056eb55f0a68315a7afc /toolkit
parent90942a2af0cabb9345cf04fa6113e12197504fcf (diff)
parent79edb388a3ce6facbb11de51eeade667dae0d995 (diff)
downloaduxp-b702d7d32a9edec41cd2dad81dcf39107c1c5ddc.tar.gz
Merge pull request #368 from trav90/safebrowsing-work
Make safebrowsing optional at build time
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/build/nsToolkitCompsModule.cpp10
-rw-r--r--toolkit/components/downloads/moz.build8
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm7
-rw-r--r--toolkit/components/moz.build4
-rw-r--r--toolkit/modules/AppConstants.jsm7
5 files changed, 33 insertions, 3 deletions
diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp
index 2c7287d8c9..190c4da066 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 477db0bd64..20394a70d2 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 bee5bf2693..3052847497 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -473,6 +473,12 @@ this.DownloadIntegration = {
* }
*/
shouldBlockForReputationCheck(aDownload) {
+#ifndef MOZ_URL_CLASSIFIER
+ return Promise.resolve({
+ shouldBlock: false,
+ verdict: "",
+ });
+#else
let hash;
let sigInfo;
let channelRedirects;
@@ -513,6 +519,7 @@ this.DownloadIntegration = {
});
});
return deferred.promise;
+#endif
},
#ifdef XP_WIN
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
index 8c065dc731..c11f627926 100644
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -61,7 +61,6 @@ DIRS += [
'tooltiptext',
'typeaheadfind',
'utils',
- 'url-classifier',
'urlformatter',
'viewconfig',
'workerloader',
@@ -94,6 +93,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 a0ca009357..d22625d14c 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,