DescriptionNoissue - Eliminate CSS rules for whitelisted domains
Consider the following filter list:
##.a
foo.com##.b
baz.com##.c
@@||foo.com^$elemhide
@@||bar.com^$elemhide
@@||baz.com^$generichide
@@||acceptable.baz.com^$elemhide
Currently abp2blocklist generates the following rule set for this list:
[
{
"trigger": {
"url-filter": "^https?://",
"url-filter-is-case-sensitive": true,
"unless-domain": [
"*baz.com",
"*foo.com",
"*bar.com",
"*acceptable.baz.com"
]
},
"action": {
"type": "css-display-none",
"selector": ".a"
}
},
{
"trigger": {
"url-filter": "^https?://([^/:]*\\.)?foo\\.com[/:]",
"url-filter-is-case-sensitive": true,
"unless-domain": [
"*foo.com",
"*bar.com",
"*acceptable.baz.com"
]
},
"action": {
"type": "css-display-none",
"selector": ".b"
}
},
{
"trigger": {
"url-filter": "^https?://([^/:]*\\.)?baz\\.com[/:]",
"url-filter-is-case-sensitive": true,
"unless-domain": [
"*foo.com",
"*bar.com",
"*acceptable.baz.com"
]
},
"action": {
"type": "css-display-none",
"selector": ".c"
}
}
]
After this change, it will generate the following rule set:
[
{
"trigger": {
"url-filter": "^https?://",
"url-filter-is-case-sensitive": true,
"unless-domain": [
"*baz.com",
"*foo.com",
"*bar.com",
"*acceptable.baz.com"
]
},
"action": {
"type": "css-display-none",
"selector": ".a"
}
},
{
"trigger": {
"url-filter": "^https?://([^/:]*\\.)?baz\\.com[/:]",
"url-filter-is-case-sensitive": true,
"unless-domain": [
"*acceptable.baz.com"
]
},
"action": {
"type": "css-display-none",
"selector": ".c"
}
}
]
What has changed:
1. There is no rule for foo.com since that domain is whitelisted
2. The unless-domain list for the rule for baz.com only includes the subdomain acceptable.baz.com
This reduces the number of rules, but by a tiny amount with EasyList+AA. It is still the right thing to do. The main benefit is that it reduces the size of the unless-domain list for each CSS rule, which greatly reduces memory consumption and increases execution speed.
Patch Set 1 #
MessagesTotal messages: 3
|