Allow Content Blocker lists to contain both if/unless-domain and if/unless-top-url trigger fields

Originator:kyle.hickinson
Number:rdar://FB7557901 Date Originated:
Status:Open Resolved:
Product:WebKit Product Version:
Classification:Suggestion Reproducible:
 
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

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!