Opened on 08/14/2016 at 09:24:04 AM
Closed on 05/22/2017 at 09:17:04 AM
Last modified on 08/02/2017 at 06:30:08 AM
#4329 closed change (fixed)
[abp2blocklist] Add (very rough) $generichide and $genericblock support
Reported by: | kzar | Assignee: | mjethani |
---|---|---|---|
Priority: | Unknown | Milestone: | |
Module: | Platform | Keywords: | abp2blocklist, AcceptableAds |
Cc: | sebastian, mario | Blocked By: | |
Blocking: | #4321, #5464 | Platform: | Unknown / Cross platform |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
https://codereview.adblockplus.org/29439639/ |
Description (last modified by mjethani)
Background
Currently abp2blocklist completely ignores $generichide and $genericblock filter options. While we cannot support them properly it might be possible to do something with them, hopefully reducing false positives. Content blocking rules have a limited unless-domain trigger field which we could perhaps use for some of our generic rules.
What to change
For $generichide exception filters, insert the rules between the generic element hiding rules and the domain-specific element hiding rules.
The rules should be in the following order:
- Generic element hiding rules (url-filter="^https?://", type="css-display-none")
- $generichide exceptions (url-filter="<specific_url>", type="ignore-previous-rules")
- Domain-specific element hiding rules (url-filter="^https?://<domain>", type="css-display-none")
- Other rules
- Other exceptions
The following filters:
##.ad blogspot.com##div.textad @@||googleblog.blogspot.com^$elemhide @@||youtube.com^$generichide
Should give us the following rules, in this order:
[ { "trigger": { "url-filter": "^https?://", "url-filter-is-case-sensitive": true }, "action": { "type": "css-display-none", "selector": ".ad" } }, { "trigger": { "url-filter": "^https?://([^/]+\\.)?youtube\\.com", "url-filter-is-case-sensitive": true }, "action": { "type": "ignore-previous-rules" } }, { "trigger": { "url-filter": "^https?://([^/:]*\\.)?blogspot\\.com[/:]", "url-filter-is-case-sensitive": true }, "action": { "type": "css-display-none", "selector": "div.textad" } }, { "trigger": { "url-filter": "^https?://([^/]+\\.)?googleblog\\.blogspot\\.com", "url-filter-is-case-sensitive": true }, "action": { "type": "ignore-previous-rules" } } ]
For $genericblock exception filters, take the hostname and put it into the unless-domain trigger for any generic blocking rules which don't already have an if-domain trigger.
The following filters:
_400x400.jpg|$image,domain=~facebook.com @@||twitter.com/hello|$genericblock
Should give us the following rules:
[ { "trigger": { "url-filter": "^https?://.*_400x400\\.jpg$", "resource-type": [ "image" ], "unless-domain": [ "*twitter.com", "*facebook.com" ] }, "action": { "type": "block" } } ]
Notes
Limitations:
- [genericblock] Adblock Plus exception filters will match the entire URL, whereas the unless-domain trigger will only match the hostname part, which means the rule will whitelist the entire domain instead of just the URL pattern
- [generichide] In Adblock Plus filters $domain matches the domain of the parent document, whereas the unless-domain trigger matches the domain of the top-level document, which means the rule will not whitelist the domain if the document is not the top-level document
Attachments (0)
Change History (10)
comment:2 Changed on 08/18/2016 at 11:49:59 AM by kzar
- Component changed from Unknown to Platform
comment:3 Changed on 05/17/2017 at 03:40:48 AM by mjethani
- Owner set to mjethani
comment:4 Changed on 05/17/2017 at 03:41:12 AM by mjethani
- Review URL(s) modified (diff)
- Status changed from new to reviewing
comment:6 Changed on 05/21/2017 at 08:15:21 PM by abpbot
A commit referencing this issue has landed:
Issue 4329 - Add $generichide support
comment:8 Changed on 05/22/2017 at 08:14:41 AM by abpbot
A commit referencing this issue has landed:
Issue 4329 - Add $genericblock support
comment:9 Changed on 05/22/2017 at 09:17:04 AM by mjethani
- Resolution set to fixed
- Status changed from reviewing to closed
comment:10 Changed on 08/02/2017 at 06:30:08 AM by mjethani
- Blocking 5464 added
I had a discussion with Sebastian and Dave and we think we can do better at least with $generichide. I'm updating the description based on this, along with more specific details on how this should work.