From 41d68e3f70b0aabc01cf9a49c43cf1aab0f4bdce Mon Sep 17 00:00:00 2001 From: trav90 Date: Sat, 12 May 2018 08:32:13 -0500 Subject: Make safebrowsing optional at build time - Part 5: preferences --- browser/app/profile/firefox.js | 2 ++ browser/branding/shared/preferences.inc | 9 --------- browser/components/preferences/blocklists.js | 2 ++ browser/components/preferences/in-content/security.js | 16 ++++------------ browser/components/preferences/in-content/security.xul | 18 ++++++++++-------- mobile/android/app/mobile.js | 2 ++ modules/libpref/init/all.js | 2 ++ 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index c021da616..e432c511d 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/branding/shared/preferences.inc b/browser/branding/shared/preferences.inc index 90fd3da06..e1b8d3be6 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/preferences/blocklists.js b/browser/components/preferences/blocklists.js index bc39eb6bd..c0ce5b656 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/security.js b/browser/components/preferences/in-content/security.js index 0d7af39a3..37a187f9c 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 5dc8ad5e9..33e1471bd 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"/> - + +#ifdef MOZ_SAFE_BROWSING + @@ -28,10 +30,6 @@ name="browser.safebrowsing.phishing.enabled" type="bool"/> - - @@ -46,6 +44,7 @@ +#endif @@ -61,7 +60,7 @@ - + diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index c0eba6596..ef4764d88 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/modules/libpref/init/all.js b/modules/libpref/init/all.js index 59476b9de..f901462b4 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5010,6 +5010,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"); @@ -5117,6 +5118,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); -- cgit v1.2.3