Enable relationship between filter and created rules
Background / User story
In order to have meaningful reporting in the SDK, we'd need a mechanism to link a filter with the particular rules that came from it. Using the getMatchedRules chrome API we should have access to the id of the rule that blocked/interacted with an item.
In terms of reporting we'd need a way of understanding which filter inside of which subscription caused this even to fire. The API does provide the rulesetId which we can use to determine which subscription was used but because ruleIds are currently just incremented in the SDK at build time we have no way of connecting these.
Relevant issue in the webext-sdk project: https://gitlab.com/eyeo/adblockplus/abc/webext-sdk/-/issues/389
What to change
This function in text2DNR can be used to encode the specific line number that the filter exists on into the id of the rule. When the rule is emitted as part of the
getMatchedRules event we'd be able to link it to the original filter
Hints for testing
- Multiple rules that come from a singular filter should still have unique ids.
- A single rule that came from a filter should point to the specific and exact line number of where that filter was found in the subscription.