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: Address PS2 comments Created May 23, 2018, 11:50 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/>.
*/
+/* globals publicSuffixes */
+
"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,22 @@
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)
- urlFilters.push(urlFilter);
+ {
+ if (!domain.includes(".") || domain.endsWith("."))
+ continue;
+ if (!(publicSuffixes.hasOwnProperty(domain)))
+ 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