RESOLVED INVALID 207540
Allow Content Blocker lists to contain both if/unless-domain and if/unless-top-url trigger fields
https://bugs.webkit.org/show_bug.cgi?id=207540
Summary Allow Content Blocker lists to contain both if/unless-domain and if/unless-to...
Kyle Hickinson
Reported 2020-02-11 06:34:45 PST
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
Radar WebKit Bug Importer
Comment 1 2020-02-11 09:26:53 PST
Maciej Stachowiak
Comment 2 2020-02-19 02:03:51 PST
Seems like a bug (but I may be missing some reason this would be an intentional limitation).
Alex Christensen
Comment 3 2020-03-19 16:52:00 PDT
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/"]
Note You need to log in before you can comment on or make changes to this bug.