Bug 1141814 - Part1: Enable to update TP list if TP is disabled, r=francois

--HG--
extra : rebase_source : 2d6622bd8323c734d127be955dc9d76e2ee24ebd
This commit is contained in:
Kershaw Chang 2016-11-23 22:22:00 +01:00
Родитель f54b06dd46
Коммит 90c2d1f846
4 изменённых файлов: 13 добавлений и 31 удалений

Просмотреть файл

@ -1217,6 +1217,8 @@ pref("privacy.donottrackheader.enabled", false);
pref("privacy.trackingprotection.enabled", false); pref("privacy.trackingprotection.enabled", false);
// Enforce tracking protection in Private Browsing mode // Enforce tracking protection in Private Browsing mode
pref("privacy.trackingprotection.pbmode.enabled", true); pref("privacy.trackingprotection.pbmode.enabled", true);
// Annotate channels based on the tracking protection list in all modes
pref("privacy.trackingprotection.annotate_channels", false);
pref("dom.event.contextmenu.enabled", true); pref("dom.event.contextmenu.enabled", true);
pref("dom.event.clipboardevents.enabled", true); pref("dom.event.clipboardevents.enabled", true);

Просмотреть файл

@ -115,11 +115,12 @@ this.SafeBrowsing = {
}, },
initialized: false, initialized: false,
phishingEnabled: false, phishingEnabled: false,
malwareEnabled: false, malwareEnabled: false,
trackingEnabled: false, trackingEnabled: false,
blockedEnabled: false, blockedEnabled: false,
trackingAnnotations: false,
phishingLists: [], phishingLists: [],
malwareLists: [], malwareLists: [],
@ -181,6 +182,7 @@ this.SafeBrowsing = {
this.malwareEnabled = Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"); this.malwareEnabled = Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled");
this.trackingEnabled = Services.prefs.getBoolPref("privacy.trackingprotection.enabled") || Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"); this.trackingEnabled = Services.prefs.getBoolPref("privacy.trackingprotection.enabled") || Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled");
this.blockedEnabled = Services.prefs.getBoolPref("browser.safebrowsing.blockedURIs.enabled"); this.blockedEnabled = Services.prefs.getBoolPref("browser.safebrowsing.blockedURIs.enabled");
this.trackingAnnotations = Services.prefs.getBoolPref("privacy.trackingprotection.annotate_channels");
[this.phishingLists, [this.phishingLists,
this.malwareLists, this.malwareLists,
@ -266,7 +268,8 @@ this.SafeBrowsing = {
controlUpdateChecking: function() { controlUpdateChecking: function() {
log("phishingEnabled:", this.phishingEnabled, "malwareEnabled:", log("phishingEnabled:", this.phishingEnabled, "malwareEnabled:",
this.malwareEnabled, "trackingEnabled:", this.trackingEnabled, this.malwareEnabled, "trackingEnabled:", this.trackingEnabled,
"blockedEnabled:", this.blockedEnabled); "blockedEnabled:", this.blockedEnabled, "trackingAnnotations",
this.trackingAnnotations);
let listManager = Cc["@mozilla.org/url-classifier/listmanager;1"]. let listManager = Cc["@mozilla.org/url-classifier/listmanager;1"].
getService(Ci.nsIUrlListManager); getService(Ci.nsIUrlListManager);
@ -300,14 +303,14 @@ this.SafeBrowsing = {
} }
} }
for (let i = 0; i < this.trackingProtectionLists.length; ++i) { for (let i = 0; i < this.trackingProtectionLists.length; ++i) {
if (this.trackingEnabled) { if (this.trackingEnabled || this.trackingAnnotations) {
listManager.enableUpdate(this.trackingProtectionLists[i]); listManager.enableUpdate(this.trackingProtectionLists[i]);
} else { } else {
listManager.disableUpdate(this.trackingProtectionLists[i]); listManager.disableUpdate(this.trackingProtectionLists[i]);
} }
} }
for (let i = 0; i < this.trackingProtectionWhitelists.length; ++i) { for (let i = 0; i < this.trackingProtectionWhitelists.length; ++i) {
if (this.trackingEnabled) { if (this.trackingEnabled || this.trackingAnnotations) {
listManager.enableUpdate(this.trackingProtectionWhitelists[i]); listManager.enableUpdate(this.trackingProtectionWhitelists[i]);
} else { } else {
listManager.disableUpdate(this.trackingProtectionWhitelists[i]); listManager.disableUpdate(this.trackingProtectionWhitelists[i]);

Просмотреть файл

@ -103,12 +103,6 @@ LazyLogModule gUrlClassifierDbServiceLog("UrlClassifierDbService");
#define CHECK_PHISHING_PREF "browser.safebrowsing.phishing.enabled" #define CHECK_PHISHING_PREF "browser.safebrowsing.phishing.enabled"
#define CHECK_PHISHING_DEFAULT false #define CHECK_PHISHING_DEFAULT false
#define CHECK_TRACKING_PREF "privacy.trackingprotection.enabled"
#define CHECK_TRACKING_DEFAULT false
#define CHECK_TRACKING_PB_PREF "privacy.trackingprotection.pbmode.enabled"
#define CHECK_TRACKING_PB_DEFAULT false
#define CHECK_BLOCKED_PREF "browser.safebrowsing.blockedURIs.enabled" #define CHECK_BLOCKED_PREF "browser.safebrowsing.blockedURIs.enabled"
#define CHECK_BLOCKED_DEFAULT false #define CHECK_BLOCKED_DEFAULT false
@ -1186,7 +1180,6 @@ nsUrlClassifierDBService::GetInstance(nsresult *result)
nsUrlClassifierDBService::nsUrlClassifierDBService() nsUrlClassifierDBService::nsUrlClassifierDBService()
: mCheckMalware(CHECK_MALWARE_DEFAULT) : mCheckMalware(CHECK_MALWARE_DEFAULT)
, mCheckPhishing(CHECK_PHISHING_DEFAULT) , mCheckPhishing(CHECK_PHISHING_DEFAULT)
, mCheckTracking(CHECK_TRACKING_DEFAULT)
, mCheckBlockedURIs(CHECK_BLOCKED_DEFAULT) , mCheckBlockedURIs(CHECK_BLOCKED_DEFAULT)
, mInUpdate(false) , mInUpdate(false)
{ {
@ -1281,9 +1274,6 @@ nsUrlClassifierDBService::Init()
CHECK_MALWARE_DEFAULT); CHECK_MALWARE_DEFAULT);
mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF, mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
CHECK_PHISHING_DEFAULT); CHECK_PHISHING_DEFAULT);
mCheckTracking =
Preferences::GetBool(CHECK_TRACKING_PREF, CHECK_TRACKING_DEFAULT) ||
Preferences::GetBool(CHECK_TRACKING_PB_PREF, CHECK_TRACKING_PB_DEFAULT);
mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF, mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF,
CHECK_BLOCKED_DEFAULT); CHECK_BLOCKED_DEFAULT);
uint32_t gethashNoise = Preferences::GetUint(GETHASH_NOISE_PREF, uint32_t gethashNoise = Preferences::GetUint(GETHASH_NOISE_PREF,
@ -1356,8 +1346,6 @@ nsUrlClassifierDBService::Init()
// situations. See Bug 1247798 and Bug 1244803. // situations. See Bug 1247798 and Bug 1244803.
Preferences::AddStrongObserver(this, CHECK_MALWARE_PREF); Preferences::AddStrongObserver(this, CHECK_MALWARE_PREF);
Preferences::AddStrongObserver(this, CHECK_PHISHING_PREF); Preferences::AddStrongObserver(this, CHECK_PHISHING_PREF);
Preferences::AddStrongObserver(this, CHECK_TRACKING_PREF);
Preferences::AddStrongObserver(this, CHECK_TRACKING_PB_PREF);
Preferences::AddStrongObserver(this, CHECK_BLOCKED_PREF); Preferences::AddStrongObserver(this, CHECK_BLOCKED_PREF);
Preferences::AddStrongObserver(this, GETHASH_NOISE_PREF); Preferences::AddStrongObserver(this, GETHASH_NOISE_PREF);
Preferences::AddStrongObserver(this, CONFIRM_AGE_PREF); Preferences::AddStrongObserver(this, CONFIRM_AGE_PREF);
@ -1775,11 +1763,6 @@ nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic,
} else if (NS_LITERAL_STRING(CHECK_PHISHING_PREF).Equals(aData)) { } else if (NS_LITERAL_STRING(CHECK_PHISHING_PREF).Equals(aData)) {
mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF, mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
CHECK_PHISHING_DEFAULT); CHECK_PHISHING_DEFAULT);
} else if (NS_LITERAL_STRING(CHECK_TRACKING_PREF).Equals(aData) ||
NS_LITERAL_STRING(CHECK_TRACKING_PB_PREF).Equals(aData)) {
mCheckTracking =
Preferences::GetBool(CHECK_TRACKING_PREF, CHECK_TRACKING_DEFAULT) ||
Preferences::GetBool(CHECK_TRACKING_PB_PREF, CHECK_TRACKING_PB_DEFAULT);
} else if (NS_LITERAL_STRING(CHECK_BLOCKED_PREF).Equals(aData)) { } else if (NS_LITERAL_STRING(CHECK_BLOCKED_PREF).Equals(aData)) {
mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF, mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF,
CHECK_BLOCKED_DEFAULT); CHECK_BLOCKED_DEFAULT);
@ -1826,8 +1809,6 @@ nsUrlClassifierDBService::Shutdown()
if (prefs) { if (prefs) {
prefs->RemoveObserver(CHECK_MALWARE_PREF, this); prefs->RemoveObserver(CHECK_MALWARE_PREF, this);
prefs->RemoveObserver(CHECK_PHISHING_PREF, this); prefs->RemoveObserver(CHECK_PHISHING_PREF, this);
prefs->RemoveObserver(CHECK_TRACKING_PREF, this);
prefs->RemoveObserver(CHECK_TRACKING_PB_PREF, this);
prefs->RemoveObserver(CHECK_BLOCKED_PREF, this); prefs->RemoveObserver(CHECK_BLOCKED_PREF, this);
prefs->RemoveObserver(PHISH_TABLE_PREF, this); prefs->RemoveObserver(PHISH_TABLE_PREF, this);
prefs->RemoveObserver(MALWARE_TABLE_PREF, this); prefs->RemoveObserver(MALWARE_TABLE_PREF, this);

Просмотреть файл

@ -118,10 +118,6 @@ private:
// uris on document loads. // uris on document loads.
bool mCheckPhishing; bool mCheckPhishing;
// TRUE if the nsURIClassifier implementation should check for tracking
// uris on document loads.
bool mCheckTracking;
// TRUE if the nsURIClassifier implementation should check for blocked // TRUE if the nsURIClassifier implementation should check for blocked
// uris on document loads. // uris on document loads.
bool mCheckBlockedURIs; bool mCheckBlockedURIs;