Port the adblocker to the Content Blockers API
Submitted by Emanuele Aina
Assigned to Adrián Pérez de Castro @aperezdc
Link to original bug (#757824)
Description
The current adblocker has a few "interesting" issues:
- it is currently broken (see bug #754954)
- it does not handle hiding elements through CSS
- it does not handle several filter options
- it internally tracks filter options using comma-separated strings and runs a regex every time it needs to checks if an option is active or not, when a bitfield would have been the obvious choice
- it uses g_strdup("1")/g_strdup("0") to store the cached results of the URL match in a GHash when a boolean would have been the obvious choice
Moving to the Content Blockers framework[1] recently added to WebKit would give us the chance to get support for hiding elements using CSS, automatic support for every filter feature supported by Safari as all the logic is in WebKit and probably better performance with likely less code and less sillyness.
[1] https://www.webkit.org/blog/3476/content-blockers-first-look/
For reference, here's the Safari version of the AdBlockPlus extension: https://hg.adblockplus.org/adblockplussafariios/
Version: git master