Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/antiadblockInit.js

Issue 29785581: Issue 6091 - Add checks for overly generic antiadblock filters (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created May 18, 2018, 8:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/antiadblockInit.js
===================================================================
--- a/lib/antiadblockInit.js
+++ b/lib/antiadblockInit.js
@@ -10,16 +10,18 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
+/* global publicSuffixes */
kzar 2018/05/22 13:24:02 Nit: Seems like we generally write "globals" inste
Jon Sonesen 2018/05/22 21:25:18 Done.
+
"use strict";
const {Prefs} = require("prefs");
const {ActiveFilter} = require("filterClasses");
const {FilterStorage} = require("filterStorage");
const {FilterNotifier} = require("filterNotifier");
const {Subscription} = require("subscriptionClasses");
const {Notification} = require("notification");
@@ -47,17 +49,23 @@
for (let filter of subscription.filters)
{
if (filter instanceof ActiveFilter && filter.domains)
{
for (let [domain, included] of filter.domains)
{
let urlFilter = "||" + domain + "^$document";
if (domain && included && urlFilters.indexOf(urlFilter) == -1)
kzar 2018/05/22 13:24:02 Seems kinda inefficient how we're doing urlFilters
Jon Sonesen 2018/05/22 18:26:11 I agree here, and was thinking about this. Was not
Thomas Greiner 2018/05/22 18:43:29 I don't know whether it'd be faster and, if so, by
- urlFilters.push(urlFilter);
+ {
+ if (["COM", "INFO", "ORG", "NET"].indexOf(domain) == -1)
Jon Sonesen 2018/05/18 20:16:18 Is hardly an exhaustive list of TLDs but there are
Thomas Greiner 2018/05/22 12:43:10 All public suffixes (including TLDs) are listed in
kzar 2018/05/22 13:24:02 Yes, I expected we would first check that the doma
Jon Sonesen 2018/05/22 18:26:11 Okay, thanks for that. Was not sure how we handled
+ {
+ if (!(publicSuffixes.hasOwnProperty(domain)))
Thomas Greiner 2018/05/22 12:43:10 Ideally, this logic would be part of `Filter.proto
kzar 2018/05/22 13:24:02 Well you're right that a filter for the domain "co
Thomas Greiner 2018/05/22 17:48:59 That's quite a pity. Nevermind then.
Jon Sonesen 2018/05/22 18:26:11 Acknowledged.
+ urlFilters.push(urlFilter);
+ }
+ }
}
}
}
notification.urlFilters = urlFilters;
Notification.addNotification(notification);
Notification.addQuestionListener(notification.id, notificationListener);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld