Bug 207540
Summary: | Allow Content Blocker lists to contain both if/unless-domain and if/unless-top-url trigger fields | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kyle Hickinson <khickinson> |
Component: | WebKit Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Enhancement | CC: | achristensen, beidson, ggaren, mjs, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Other | ||
Hardware: | All | ||
OS: | Unspecified |
Kyle Hickinson
The current content blocker API fails to compile a list if you attempt to have a list that contains both the `if-domain` and `if-top-url` (or `unless-domain` and `unless-top-url`) url triggers, even if said triggers are not in the same rule. For example, this list will fail to compile:
```
[
{
"trigger": {
"url-filter": ".*",
"resource-type": ["image", "style-sheet"],
"unless-domain": ["foo.com", "bar.com"]
},
"action": {
"type": "block"
}
},
{
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"unless-top-url": "baz.com",
},
"action": {
"type": "block"
}
}
]
```
These two rules are completely unrelated to each other, but WebKit will fail to compile this list because of the usage of both `unless-domain` and `unless-top-url` in the same file
This limitation isn't specified in the documentation around these triggers. The only thing the documentation specifies is that you cannot use `if-domain` and `unless-domain`, or `if-top-url` and `unless-top-url` in the same rule.
I think the expected result is that these rules should be allowed to co-exist in the same list
rdar://FB7557901
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/59350914>
Maciej Stachowiak
Seems like a bug (but I may be missing some reason this would be an intentional limitation).
Alex Christensen
This is intentional. We want to limit the number of times we must run URLs through the finite state machine. if-domain and unless-domain runs the domain of the top URL though the finite state machine. if-top-url and unless-top-url run the whole top URL through the finite state machine. If you want "both" then write a regular expression that, when run on the entire top URL, looks at the domain, like this:
"unless-top-url": [".*://foo.com/", ".*://bar.com/"]