Implement important option for snippet filters
Background
The question of the order in which snippet filters are applied has come up (see https://issues.adblockplus.org/ticket/7462). While it's easy enough to include two or more snippet invocations in the same script (e.g. example.com#$#snippet-1 arg-1 arg-2; snippet-2 arg-1 arg-2
), sometimes the filters come from different filter lists or different sections of the same filter list, which must appear in a certain order for maintenance reasons.
At the very least, it might be a good idea to implement something to allow filter list authors to prioritize one snippet filter over another as a temporary fix (note: like !important
in CSS, this would be a hack, but it could be used for testing out a filter (e.g. see https://issues.adblockplus.org/ticket/7248)).
One possible solution might be:
- If the script begins with a
!
, then it is prioritized (e.g.example.com#$#!snippet-2
always applies beforeexample.com#$#snippet-1
) - For scripts at the same level of importance, the order is still unspecified
Note: The importance of solving this problem is unknown at this point.
What to change
To be determined, but likely parseScript()
should set an important
flag in its return value and snippets.getFiltersForDomain()
should return the important filters first.