diff --git a/src/_locales/en_US/messages.json b/src/_locales/en_US/messages.json index 00c5ad6962..53402748b8 100644 --- a/src/_locales/en_US/messages.json +++ b/src/_locales/en_US/messages.json @@ -89,6 +89,12 @@ "options_title": { "message": "Privacy Badger Options" }, + "options_dnt_policy_setting": { + "message": "Check if sites comply with EFF's Do Not Track policy" + }, + "options_dnt_policy_learn_more": { + "message": "Learn more" + }, "options_webrtc_setting": { "message": "Prevent WebRTC from leaking local IP address *" }, diff --git a/src/js/background.js b/src/js/background.js index a8f1da0c66..86fabb5579 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -298,6 +298,11 @@ Badger.prototype = { * Fetch acceptable DNT policy hashes from the EFF server */ updateDNTPolicyHashes: function(){ + if (! badger.isCheckingDNTPolicyEnabled()) { + // user has disabled this, we can check when they re-enable + return ; + } + var self = this; utils.xhrRequest(constants.DNT_POLICIES_URL, function(err,response){ if(err){ @@ -322,10 +327,15 @@ Badger.prototype = { return; } - log('Checking', domain, 'for DNT policy.'); - var badger = this; + if (! badger.isCheckingDNTPolicyEnabled()) { + // user has disabled this check + return ; + } + + log('Checking', domain, 'for DNT policy.'); + // update timestamp first; // avoids queuing the same domain multiple times var recheckTime = utils.getRandom( @@ -382,6 +392,7 @@ Badger.prototype = { */ defaultSettings: { socialWidgetReplacementEnabled: true, + checkForDNTPolicy: true, showCounter: true, disabledSites: [], isFirstRun: true, @@ -565,6 +576,10 @@ Badger.prototype = { return this.getSettings().getItem("socialWidgetReplacementEnabled"); }, + isCheckingDNTPolicyEnabled: function() { + return this.getSettings().getItem("checkForDNTPolicy"); + }, + /** * Check if WebRTC IP leak protection is enabled; query Chrome's internal * value, update our local setting if it has gone out of sync, then return our diff --git a/src/js/options.js b/src/js/options.js index fdabd5dc5e..7cf0dc759b 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -76,6 +76,8 @@ function loadOptions() { $("#show_counter_checkbox").prop("checked", badger.showCounter()); $("#replace_social_widgets_checkbox").click(updateSocialWidgetReplacement); $("#replace_social_widgets_checkbox").prop("checked", badger.isSocialWidgetReplacementEnabled()); + $("#check_dnt_policy_checkbox").click(updateCheckingDNTPolicy); + $("#check_dnt_policy_checkbox").prop("checked", badger.isCheckingDNTPolicyEnabled()); if(chrome.privacy && badger.webRTCAvailable){ $("#toggle_webrtc_mode").click(toggleWebRTCIPProtection); $("#toggle_webrtc_mode").prop("checked", badger.isWebRTCIPProtectionEnabled()); @@ -210,6 +212,12 @@ function updateSocialWidgetReplacement() { settings.setItem("socialWidgetReplacementEnabled", replaceSocialWidgets); } +function updateCheckingDNTPolicy() { + var newDNTSetting = $("#check_dnt_policy_checkbox").prop("checked"); + settings.setItem("checkForDNTPolicy", newDNTSetting); + refreshFilterPage(); // This setting means sites need to be re-evaluated +} + function reloadWhitelist() { var sites = settings.getItem("disabledSites"); var sitesList = $('#excludedDomainsBox'); diff --git a/src/js/storage.js b/src/js/storage.js index 25462cf242..3a06594709 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -99,6 +99,10 @@ BadgerPen.prototype = { * @returns {String} the presumed action for this FQDN **/ getAction: function (domain, ignoreDNT) { + if(! badger.isCheckingDNTPolicyEnabled()){ + ignoreDNT = true; + } + if (_.isString(domain)) { domain = this.getBadgerStorageObject('action_map').getItem(domain) || {}; } diff --git a/src/skin/options.html b/src/skin/options.html index 44f7f5c838..b8a1f119d9 100644 --- a/src/skin/options.html +++ b/src/skin/options.html @@ -207,6 +207,13 @@

+
+ + +