ghostery / adblocker

Efficient embeddable adblocker library
https://www.ghostery.com
Mozilla Public License 2.0
794 stars 101 forks source link

fix: filters being duplicated by preprocessors #4016

Closed seia-soto closed 3 months ago

seia-soto commented 3 months ago

This PR solves the problem that created duplicated entries in the filters engine. The problem was found as scriptlets injected multiple times (more than intended) on YouTube. After then, the fact that those filters had preprocessors revealed. The problem was in updateFromDiff function that pushes preprocessor filters to normal filters diff. The mental model and understanding to the diff object was not clear, so this problem happened.

To prevent similar issues in future, tests and comments are added.