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

Unified Diff: lib/filterComposer.js

Issue 29335437: Issue 3620 - Make "Block element" generate domain specific filters when $genericblock is active (Closed)
Patch Set: Created Feb. 3, 2016, 10:25 a.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/filterComposer.js
===================================================================
--- a/lib/filterComposer.js
+++ b/lib/filterComposer.js
@@ -96,6 +96,7 @@
{
let typeMask = RegExpFilter.typeMap[details.type];
let docDomain = extractHostFromFrame(frame);
+ let specificOnly = checkWhitelisted(page, frame, RegExpFilter.typeMap.GENERICBLOCK);
kzar 2016/02/03 10:29:41 Nit: Long line
// Add a blocking filter for each URL of the element that can be blocked
for (let url of details.urls)
@@ -106,13 +107,16 @@
let filter = defaultMatcher.whitelist.matchesAny(
url, typeMask, docDomain,
isThirdParty(urlObj, docDomain),
- getKey(page, frame)
+ getKey(page, frame), specificOnly
);
if (!filter)
{
let filterText = url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||");
+ if (specificOnly)
+ filterText += "$domain=" + docDomain;
+
if (filters.indexOf(filterText) == -1)
filters.push(filterText);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld