Bug 1141814 - Part 1: Enable to update TP list if TP is disabled. r=francois

This commit is contained in:
Kershaw Chang 2016-11-30 23:12:00 -05:00
Родитель a10ef666dd
Коммит ccfc159353
4 изменённых файлов: 13 добавлений и 31 удалений

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

@ -1220,6 +1220,8 @@ pref("privacy.donottrackheader.enabled", false);
pref("privacy.trackingprotection.enabled", false);
// Enforce tracking protection in Private Browsing mode
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.clipboardevents.enabled", true);

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

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

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

@ -103,12 +103,6 @@ LazyLogModule gUrlClassifierDbServiceLog("UrlClassifierDbService");
#define CHECK_PHISHING_PREF "browser.safebrowsing.phishing.enabled"
#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_DEFAULT false
@ -1208,7 +1202,6 @@ nsUrlClassifierDBService::GetInstance(nsresult *result)
nsUrlClassifierDBService::nsUrlClassifierDBService()
: mCheckMalware(CHECK_MALWARE_DEFAULT)
, mCheckPhishing(CHECK_PHISHING_DEFAULT)
, mCheckTracking(CHECK_TRACKING_DEFAULT)
, mCheckBlockedURIs(CHECK_BLOCKED_DEFAULT)
, mInUpdate(false)
{
@ -1303,9 +1296,6 @@ nsUrlClassifierDBService::Init()
CHECK_MALWARE_DEFAULT);
mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
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,
CHECK_BLOCKED_DEFAULT);
uint32_t gethashNoise = Preferences::GetUint(GETHASH_NOISE_PREF,
@ -1379,8 +1369,6 @@ nsUrlClassifierDBService::Init()
// situations. See Bug 1247798 and Bug 1244803.
Preferences::AddStrongObserver(this, CHECK_MALWARE_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, GETHASH_NOISE_PREF);
Preferences::AddStrongObserver(this, CONFIRM_AGE_PREF);
@ -1824,11 +1812,6 @@ nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic,
} else if (NS_LITERAL_STRING(CHECK_PHISHING_PREF).Equals(aData)) {
mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
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)) {
mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF,
CHECK_BLOCKED_DEFAULT);
@ -1886,8 +1869,6 @@ nsUrlClassifierDBService::Shutdown()
if (prefs) {
prefs->RemoveObserver(CHECK_MALWARE_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(PHISH_TABLE_PREF, this);
prefs->RemoveObserver(MALWARE_TABLE_PREF, this);

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

@ -120,10 +120,6 @@ private:
// uris on document loads.
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
// uris on document loads.
bool mCheckBlockedURIs;