Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Add a 1st party check to the SelectorsPollerScript.js (non-aggressive cosmetic filtering) #7294

Closed
cuba opened this issue Apr 19, 2023 · 1 comment
Assignees
Milestone

Comments

@cuba
Copy link
Contributor

cuba commented Apr 19, 2023

Description:

We use aggressive cosmetic filtering in iOS. In order to make it non-aggressive we need to add a 1st party check on element urls. Currently the check in hard coded to return false except for some small edge cases like relative URLs. The difficulty in doing this is we have to do it asynchronously as we need to talk back to iOS to do a proper etld+1 check.

The idea is to

  1. Add a mutation observer that looks for images and videos
  2. Every time it gets one, extract the domain for it, and pass it async to iOS to get a yes/no isFirstParty value
  3. Keep track of all the answers you’ve gotten for the current page in a Brave maintained Map
  4. Check that map in the cosmetic filtering isFirstParty function
  5. Re-check ads where isFirstParty() returns false every time you get a new answer from 2

Once this is done we need to remove the temporary exception we have added to https://github.com/brave/adblock-lists/blob/master/brave-lists/brave-ios-specific.txt

@cuba
Copy link
Contributor Author

cuba commented May 24, 2023

Done with the following PR: #7333

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants