summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--browser/app/profile/firefox.js2
-rw-r--r--browser/base/content/browser-doctype.inc2
-rw-r--r--browser/base/content/browser-safebrowsing.js2
-rwxr-xr-xbrowser/base/content/browser.js8
-rwxr-xr-xbrowser/base/content/global-scripts.inc2
-rw-r--r--browser/base/content/utilityOverlay.js3
-rw-r--r--browser/base/jar.mn4
-rw-r--r--browser/branding/shared/preferences.inc9
-rw-r--r--browser/components/about/AboutRedirector.cpp2
-rw-r--r--browser/components/build/nsModule.cpp2
-rw-r--r--browser/components/preferences/blocklists.js2
-rw-r--r--browser/components/preferences/in-content/jar.mn2
-rw-r--r--browser/components/preferences/in-content/security.js16
-rw-r--r--browser/components/preferences/in-content/security.xul18
-rwxr-xr-xbrowser/confvars.sh1
-rw-r--r--browser/installer/package-manifest.in2
-rw-r--r--browser/locales/jar.mn2
-rw-r--r--mobile/android/app/mobile.js2
-rw-r--r--mobile/android/chrome/content/browser.js8
-rw-r--r--mobile/android/components/MobileComponents.manifest2
-rw-r--r--mobile/android/confvars.sh1
-rw-r--r--mobile/android/installer/package-manifest.in2
-rw-r--r--modules/libpref/init/all.js2
-rw-r--r--old-configure.in17
-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
29 files changed, 110 insertions, 39 deletions
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index c021da6164..e432c511db 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -964,8 +964,10 @@ pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
pref("services.sync.prefs.sync.browser.newtabpage.enabled", true);
pref("services.sync.prefs.sync.browser.newtabpage.pinned", true);
pref("services.sync.prefs.sync.browser.offline-apps.notify", true);
+#ifdef MOZ_SAFE_BROWSING
pref("services.sync.prefs.sync.browser.safebrowsing.phishing.enabled", true);
pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true);
+#endif
pref("services.sync.prefs.sync.browser.search.update", true);
pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
pref("services.sync.prefs.sync.browser.startup.homepage", true);
diff --git a/browser/base/content/browser-doctype.inc b/browser/base/content/browser-doctype.inc
index 10015d898c..ad08f4b034 100644
--- a/browser/base/content/browser-doctype.inc
+++ b/browser/base/content/browser-doctype.inc
@@ -13,8 +13,10 @@
%customizeToolbarDTD;
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
+#ifdef MOZ_SAFE_BROWSING
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
%safebrowsingDTD;
+#endif
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD;
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
diff --git a/browser/base/content/browser-safebrowsing.js b/browser/base/content/browser-safebrowsing.js
index 430d84f132..a66595b2d2 100644
--- a/browser/base/content/browser-safebrowsing.js
+++ b/browser/base/content/browser-safebrowsing.js
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#ifdef MOZ_SAFE_BROWSING
var gSafeBrowsing = {
setReportPhishingMenu: function() {
@@ -46,3 +47,4 @@ var gSafeBrowsing = {
return SafeBrowsing.getReportURL(name, gBrowser.currentURI);
}
}
+#endif
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 2380f5d21c..8679bca831 100755
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -60,8 +60,10 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["webrtcUI", "resource:///modules/webrtcUI.jsm", ]
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
-XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
- "resource://gre/modules/SafeBrowsing.jsm");
+#ifdef MOZ_SAFE_BROWSING
+ XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
+ "resource://gre/modules/SafeBrowsing.jsm");
+#endif
// lazy service getters
[
@@ -1200,8 +1202,10 @@ var gBrowserInit = {
}
}
+#ifdef MOZ_SAFE_BROWSING
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
setTimeout(function() { SafeBrowsing.init(); }, 2000);
+#endif
Services.obs.addObserver(gIdentityHandler, "perm-changed", false);
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
diff --git a/browser/base/content/global-scripts.inc b/browser/base/content/global-scripts.inc
index dac75878da..ca942cec88 100755
--- a/browser/base/content/global-scripts.inc
+++ b/browser/base/content/global-scripts.inc
@@ -23,7 +23,9 @@
<script type="application/javascript" src="chrome://browser/content/browser-places.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-plugins.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-refreshblocker.js"/>
+#ifdef MOZ_SAFE_BROWSING
<script type="application/javascript" src="chrome://browser/content/browser-safebrowsing.js"/>
+#endif
<script type="application/javascript" src="chrome://browser/content/browser-sidebar.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-social.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-syncui.js"/>
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js
index b041915a7c..4ea6d8f900 100644
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -819,9 +819,8 @@ function openTourPage()
function buildHelpMenu()
{
// Enable/disable the "Report Web Forgery" menu item.
- if (typeof gSafeBrowsing != "undefined") {
+ if (typeof gSafeBrowsing != "undefined")
gSafeBrowsing.setReportPhishingMenu();
- }
}
function isElementVisible(aElement)
diff --git a/browser/base/jar.mn b/browser/base/jar.mn
index c582653513..03854f75d0 100644
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -84,7 +84,9 @@ browser.jar:
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-plugins.js (content/browser-plugins.js)
content/browser/browser-refreshblocker.js (content/browser-refreshblocker.js)
+#ifdef MOZ_SAFE_BROWSING
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
+#endif
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-social.js (content/browser-social.js)
* content/browser/browser-syncui.js (content/browser-syncui.js)
@@ -186,8 +188,10 @@ browser.jar:
# the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html
+#ifdef MOZ_SAFE_BROWSING
content/browser/report-phishing-overlay.xul (content/report-phishing-overlay.xul)
content/browser/blockedSite.xhtml (content/blockedSite.xhtml)
% overlay chrome://browser/content/browser.xul chrome://browser/content/report-phishing-overlay.xul
+#endif
% override chrome://global/content/netError.xhtml chrome://browser/content/aboutNetError.xhtml
diff --git a/browser/branding/shared/preferences.inc b/browser/branding/shared/preferences.inc
index 90fd3da066..e1b8d3be6f 100644
--- a/browser/branding/shared/preferences.inc
+++ b/browser/branding/shared/preferences.inc
@@ -22,14 +22,5 @@ pref("app.update.badgeWaitTime", 0);
// If this is less than 5, then pasting code into the web console or scratchpad is disabled
pref("devtools.selfxss.count", 100);
-// Disable Google Safebrowsing by default. Without an API key, this won't work.
-pref("browser.safebrowsing.phishing.enabled", false);
-pref("browser.safebrowsing.malware.enabled", false);
-pref("browser.safebrowsing.downloads.enabled", false);
-pref("browser.safebrowsing.downloads.remote.enabled", false);
-
-// Disable the UI controls for it as well for Basilisk-official.
-pref("browser.safebrowsing.UI.enabled", false);
-
//
pref("general.useragent.appVersionIsBuildID", true);
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp
index 717ae9c48a..5e8df6ab2d 100644
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -40,6 +40,7 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
+#ifdef MOZ_SAFE_BROWSING
{
"blocked", "chrome://browser/content/blockedSite.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
@@ -47,6 +48,7 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
+#endif
{
"certerror", "chrome://browser/content/aboutNetError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp
index 1fad0ce68d..967da3ebc1 100644
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -86,7 +86,9 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#endif
{ NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "basilisk", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
+#ifdef MOZ_SAFE_BROWSING
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
+#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "providerdirectory", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
diff --git a/browser/components/preferences/blocklists.js b/browser/components/preferences/blocklists.js
index bc39eb6bd9..c0ce5b6568 100644
--- a/browser/components/preferences/blocklists.js
+++ b/browser/components/preferences/blocklists.js
@@ -6,9 +6,11 @@ Components.utils.import("resource://gre/modules/Services.jsm");
const BASE_LIST_ID = "base";
const CONTENT_LIST_ID = "content";
const TRACK_SUFFIX = "-track-digest256";
+#ifdef MOZ_SAFE_BROWSING
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
const UPDATE_TIME_PREF = "browser.safebrowsing.provider.mozilla.nextupdatetime";
+#endif
var gBlocklistManager = {
_type: "",
diff --git a/browser/components/preferences/in-content/jar.mn b/browser/components/preferences/in-content/jar.mn
index 3497ff5555..130bf8549c 100644
--- a/browser/components/preferences/in-content/jar.mn
+++ b/browser/components/preferences/in-content/jar.mn
@@ -14,5 +14,5 @@ browser.jar:
content/browser/preferences/in-content/applications.js
* content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.js
- content/browser/preferences/in-content/security.js
+* content/browser/preferences/in-content/security.js
content/browser/preferences/in-content/search.js
diff --git a/browser/components/preferences/in-content/security.js b/browser/components/preferences/in-content/security.js
index 0d7af39a3d..37a187f9c9 100644
--- a/browser/components/preferences/in-content/security.js
+++ b/browser/components/preferences/in-content/security.js
@@ -23,7 +23,9 @@ var gSecurityPane = {
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
+#ifdef MOZ_SAFE_BROWSING
this._initSafeBrowsing();
+#endif
setEventListener("addonExceptions", "command",
gSecurityPane.showAddonExceptions);
@@ -160,6 +162,7 @@ var gSecurityPane = {
checkbox.checked = !noMP;
},
+#ifdef MOZ_SAFE_BROWSING
_initSafeBrowsing() {
let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
let blockDownloads = document.getElementById("blockDownloads");
@@ -168,24 +171,12 @@ var gSecurityPane = {
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
- let safeBrowsingUIPref = document.getElementById("browser.safebrowsing.UI.enabled");
- let safeBrowsingUISep = document.getElementById("safeBrowsingUISep");
- let safeBrowsingUIGroup = document.getElementById("safeBrowsingUIGroup");
-
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
let malwareTable = document.getElementById("urlclassifier.malwareTable");
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
- if (safeBrowsingUIPref.value == false) {
- safeBrowsingUISep.setAttribute("hidden", "true");
- safeBrowsingUIGroup.setAttribute("hidden", "true");
- } else {
- safeBrowsingUISep.removeAttribute("hidden");
- safeBrowsingUIGroup.removeAttribute("hidden");
- }
-
enableSafeBrowsing.addEventListener("command", function() {
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
@@ -244,6 +235,7 @@ var gSecurityPane = {
blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
},
+#endif
/**
* Enables/disables the master password button depending on the state of the
diff --git a/browser/components/preferences/in-content/security.xul b/browser/components/preferences/in-content/security.xul
index 5dc8ad5e92..33e1471bd5 100644
--- a/browser/components/preferences/in-content/security.xul
+++ b/browser/components/preferences/in-content/security.xul
@@ -16,11 +16,13 @@
name="pref.privacy.disable_button.view_passwords_exceptions"
type="bool"/>
- <!-- Add-ons, malware, phishing -->
+ <!-- Add-ons -->
<preference id="xpinstall.whitelist.required"
name="xpinstall.whitelist.required"
type="bool"/>
+#ifdef MOZ_SAFE_BROWSING
+ <!-- Malware, phishing -->
<preference id="browser.safebrowsing.malware.enabled"
name="browser.safebrowsing.malware.enabled"
type="bool"/>
@@ -28,10 +30,6 @@
name="browser.safebrowsing.phishing.enabled"
type="bool"/>
- <preference id="browser.safebrowsing.UI.enabled"
- name="browser.safebrowsing.UI.enabled"
- type="bool"/>
-
<preference id="browser.safebrowsing.downloads.enabled"
name="browser.safebrowsing.downloads.enabled"
type="bool"/>
@@ -46,6 +44,7 @@
<preference id="browser.safebrowsing.downloads.remote.block_uncommon"
name="browser.safebrowsing.downloads.remote.block_uncommon"
type="bool"/>
+#endif
<!-- Passwords -->
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
@@ -61,7 +60,7 @@
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox>
-<!-- addons, forgery (phishing) UI -->
+<!-- addons -->
<groupbox id="addonsPhishingGroup" data-category="paneSecurity" hidden="true">
<caption><label>&general.label;</label></caption>
@@ -77,8 +76,10 @@
accesskey="&addonExceptions.accesskey;"/>
</hbox>
- <separator id="safeBrowsingUISep" class="thin"/>
- <vbox id="safeBrowsingUIGroup" align="start">
+#ifdef MOZ_SAFE_BROWSING
+<!-- Safebrowsing (phishing) UI -->
+ <separator class="thin"/>
+ <vbox align="start">
<checkbox id="enableSafeBrowsing"
label="&enableSafeBrowsing.label;"
accesskey="&enableSafeBrowsing.accesskey;" />
@@ -91,6 +92,7 @@
accesskey="&blockUncommonUnwanted.accesskey;" />
</vbox>
</vbox>
+#endif
</groupbox>
<!-- Passwords -->
diff --git a/browser/confvars.sh b/browser/confvars.sh
index 41c0be3d74..0343034a41 100755
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -59,6 +59,7 @@ MOZ_DEVTOOLS=1
MOZ_SERVICES_COMMON=1
MOZ_SERVICES_SYNC=1
MOZ_SERVICES_HEALTHREPORT=
+MOZ_SAFE_BROWSING=
# Disable checking that add-ons are signed by the trusted root
MOZ_ADDON_SIGNING=0
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index 4ef8942b59..0f79bd031a 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -578,12 +578,14 @@
@RESPATH@/browser/modules/*
@RESPATH@/modules/*
+#ifdef MOZ_URL_CLASSIFIER
; Safe Browsing
@RESPATH@/components/nsURLClassifier.manifest
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/url-classifier.xpt
+#endif
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt
diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn
index 6d76d20f0b..31cbd9ccff 100644
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -53,8 +53,10 @@
locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd)
locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd)
+#ifdef MOZ_SAFE_BROWSING
locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd)
locale/browser/safebrowsing/report-phishing.dtd (%chrome/browser/safebrowsing/report-phishing.dtd)
+#endif
locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd)
locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties)
locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd)
diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js
index c0eba6596b..ef4764d88e 100644
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -636,9 +636,11 @@ pref("media.eme.apiVisible", false);
// optimize images memory usage
pref("image.downscale-during-decode.enabled", true);
+#ifdef MOZ_SAFE_BROWSING
pref("browser.safebrowsing.downloads.enabled", false);
pref("browser.safebrowsing.id", @MOZ_APP_UA_NAME@);
+#endif
// True if this is the first time we are showing about:firstrun
pref("browser.firstrun.show.uidiscovery", true);
diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
index b00e1af150..e2706f4b26 100644
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -57,8 +57,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerParent",
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
- "resource://gre/modules/SafeBrowsing.jsm");
+#ifdef MOZ_SAFE_BROWSING
+ XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
+ "resource://gre/modules/SafeBrowsing.jsm");
+#endif
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
@@ -530,8 +532,10 @@ var BrowserApp = {
InitLater(() => Services.search.init(), Services, "search");
InitLater(() => DownloadNotifications.init(), window, "DownloadNotifications");
+#ifdef MOZ_SAFE_BROWSING
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
InitLater(() => SafeBrowsing.init(), window, "SafeBrowsing");
+#endif
InitLater(() => Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager));
InitLater(() => LoginManagerParent.init(), window, "LoginManagerParent");
diff --git a/mobile/android/components/MobileComponents.manifest b/mobile/android/components/MobileComponents.manifest
index 8cf8f9a27e..5194de48fc 100644
--- a/mobile/android/components/MobileComponents.manifest
+++ b/mobile/android/components/MobileComponents.manifest
@@ -14,7 +14,9 @@ contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {322ba47e-70
#ifdef MOZ_SERVICES_HEALTHREPORT
contract @mozilla.org/network/protocol/about;1?what=healthreport {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#endif
+#ifdef MOZ_SAFE_BROWSING
contract @mozilla.org/network/protocol/about;1?what=blocked {322ba47e-7047-4f71-aebf-cb7d69325cd9}
+#endif
contract @mozilla.org/network/protocol/about;1?what=accounts {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=logins {322ba47e-7047-4f71-aebf-cb7d69325cd9}
diff --git a/mobile/android/confvars.sh b/mobile/android/confvars.sh
index a804afe22b..869d0332ed 100644
--- a/mobile/android/confvars.sh
+++ b/mobile/android/confvars.sh
@@ -24,6 +24,7 @@ MOZ_ANDROID_APPLICATION_CLASS=org.mozilla.gecko.GeckoApplication
MOZ_ANDROID_BROWSER_INTENT_CLASS=org.mozilla.gecko.BrowserApp
MOZ_ANDROID_SEARCH_INTENT_CLASS=org.mozilla.search.SearchActivity
+MOZ_SAFE_BROWSING=
MOZ_NO_SMART_CARDS=1
MOZ_XULRUNNER=
diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in
index 067f9dde12..ee5244a6d1 100644
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -417,12 +417,14 @@
; Modules
@BINPATH@/modules/*
+#ifdef MOZ_SAFE_BROWSING
; Safe Browsing
@BINPATH@/components/nsURLClassifier.manifest
@BINPATH@/components/nsUrlClassifierHashCompleter.js
@BINPATH@/components/nsUrlClassifierListManager.js
@BINPATH@/components/nsUrlClassifierLib.js
@BINPATH@/components/url-classifier.xpt
+#endif
; Private Browsing
@BINPATH@/components/privatebrowsing.xpt
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index a1016a820b..18e23ff2eb 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4990,6 +4990,7 @@ pref("dom.flyweb.enabled", false);
// Enable mapped array buffer by default.
pref("dom.mapped_arraybuffer.enabled", true);
+#ifdef MOZ_SAFE_BROWSING
// The tables used for Safebrowsing phishing and malware checks.
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");
@@ -5097,6 +5098,7 @@ pref("browser.safebrowsing.id", "navclient-auto-ffox");
#else
pref("browser.safebrowsing.id", "Firefox");
#endif
+#endif
// Turn off Spatial navigation by default.
pref("snav.enabled", false);
diff --git a/old-configure.in b/old-configure.in
index 1670a90b6e..1af302d111 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -2237,6 +2237,7 @@ LIBJPEG_TURBO_AS=
LIBJPEG_TURBO_ASFLAGS=
MOZ_PREF_EXTENSIONS=1
MOZ_REFLOW_PERF=
+MOZ_SAFE_BROWSING=
MOZ_SPELLCHECK=1
MOZ_TOOLKIT_SEARCH=1
MOZ_UI_LOCALE=en-US
@@ -3952,8 +3953,24 @@ fi
AC_SUBST(MOZ_SYSTEM_SQLITE)
dnl ========================================================
+dnl = Enable Google safe browsing (anti-phishing)
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(safe-browsing,
+[ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
+ MOZ_SAFE_BROWSING=1,
+ MOZ_SAFE_BROWSING= )
+if test -n "$MOZ_SAFE_BROWSING"; then
+ AC_DEFINE(MOZ_SAFE_BROWSING)
+fi
+AC_SUBST(MOZ_SAFE_BROWSING)
+
+dnl ========================================================
dnl = Enable url-classifier
dnl ========================================================
+dnl Implicitly enabled by default if building with safe-browsing
+if test -n "$MOZ_SAFE_BROWSING"; then
+ MOZ_URL_CLASSIFIER=1
+fi
MOZ_ARG_ENABLE_BOOL(url-classifier,
[ --enable-url-classifier Enable url classifier module],
MOZ_URL_CLASSIFIER=1,
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,