Make safebrowsing optional at build time - Part 5: preferences

This commit is contained in:
trav90 2018-05-12 08:32:13 -05:00 committed by Roy Tam
commit dbcd0c066f
7 changed files with 22 additions and 29 deletions

View file

@ -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: "",

View file

@ -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

View file

@ -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 -->