brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.56k stars 2.28k forks source link

Share adblock code between iOS and brave-core #41017

Open antonok-edm opened 1 week ago

antonok-edm commented 1 week ago

Right now, iOS's SelectorsPollerScript.js and brave-core's content_cosmetic.ts have a lot of duplicated code in common, especially related to procedural filtering as of https://github.com/brave/brave-core/pull/24688. If the iOS builds can use Typescript for the injections, we can import shared functionality from one set of .ts files as the single source of truth.

Additionally, much of the logic in AdBlockService is duplicated. Until iOS can use AdBlockService directly, the code can be broken out into a common AdBlockServiceBase or something similar, and exposed through an Objective-C wrapper.

ShivanKaul commented 6 days ago

(We run into bugs that stem from the lack of commonality between brave-core and iOS adblocking code extremely frequently so this is an important refactoring)