Opened 21 months ago

Last modified 7 months ago

#5296 new change

[abp2blocklist] Improve $genericblock support using unless-top-url

Reported by: mjethani Assignee:
Priority: Unknown Milestone:
Module: Adblock-Plus-for-iOS/macOS Keywords: abp2blocklist
Cc: kzar, sebastian, mario Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Background

In #4329 we added limited support for $genericblock using the unless-domain property. Apple has added a new property in Safari 11 called unless-top-url, which takes a URL pattern instead of just a domain name. Now we can whitelist specific URL patterns instead of whitelisting the entire domain. Since Safari ignores any properties it does not recognize, we can start using this property in our content blocker rules right away.

What to change

Instead of unless-domain, use unless-top-url to implement $genericblock. Add any URL pattern to the list, even if it doesn't contain the hostname.

Continue to use unless-domain to support older versions of Safari based on a configuration flag.

Change History (2)

comment:1 Changed 21 months ago by sebastian

For reference, this change would unsupport $genericblock on Safari <=10, again. But FWIW, I think this is fine, if we can get more accurrate behavior on newer Safari versions, and possibly also simplify the code, with this change.

Also note that we could potentially make $document whitelisting more accurately as well using if-top-url, as they are supposed to be recursive.

comment:2 Changed 7 months ago by sebastian

  • Component changed from Platform to Adblock-Plus-for-iOS
Note: See TracTickets for help on using tickets.