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

Fix #7360: Add non-aggressive cosmetic filters #7333

Merged
merged 3 commits into from
May 10, 2023

Conversation

cuba
Copy link
Contributor

@cuba cuba commented Apr 25, 2023

Summary of Changes

This pull request fixes #7360

This adds code to support standard mode but until UI is available, we cannot enable it. For this ticket we are testing for unchanged (aggressive) cosmetic filters. Standard mode can only be enabled through code changes for the time being and will be tested once the UI is ready. The UI is done in the following issue: #7352

Note: The logs will be removed before merging. Feel free to leave a comment but it will be the last thing I will do because it is difficult to test scripts in webkit.

Submitter Checklist:

  • Unit Tests are updated to cover new or changed functionality
  • User-facing strings use NSLocalizableString()
  • New or updated UI has been tested across:
    • Light & dark mode
    • Different size classes (iPhone, landscape, iPad)
    • Different dynamic type sizes

Test Plan:

NOTE: These tests are also covered here which will be deployed together with this PR. You can skip these tests here as they duplicated there.

  1. Test any known cosmetic filtering for pages like reddit:
  2. Go to brave search and search for "trezor".
  • The ad on the top of the page should be shown on standard mode and hidden on aggressive.
  1. Enable "Block cookie consent notices" and go to reddit.
  • Cookie notices should be blocked on standard and aggressive
  1. Enable "Block open in app notices" and go to reddit.
  • [] Open in app notices should be blocked on standard and aggressive
  1. Go to the following page: https://dev-pages.brave.software/filtering/cosmetic-filtering.html
  • On aggressive mode, all images should be hidden after clicking "Run tests"
  • On standard mode, only 3rd party images should be hidden after clicking "Run tests"

Note: Without the UI here the script is set to standard mode. You cannot test aggressive mode without this code merged.

Screenshots:

Reviewer Checklist:

  • Issues include necessary QA labels:
    • QA/(Yes|No)
    • bug / enhancement
  • Necessary security reviews have taken place.
  • Adequate unit test coverage exists to prevent regressions.
  • Adequate test plan exists for QA to validate (if applicable).
  • Issue and pull request is assigned to a milestone (should happen at merge time).

@cuba cuba force-pushed the js/non-agressive-cosmetic-filters branch 6 times, most recently from f28bac9 to 7c0fe1d Compare April 28, 2023 18:45
@cuba cuba changed the title Add non-aggressive cosmetic filters Fix #7352: Add non-aggressive cosmetic filters Apr 28, 2023
@cuba cuba changed the title Fix #7352: Add non-aggressive cosmetic filters Fix #7360: Add non-aggressive cosmetic filters Apr 28, 2023
@cuba cuba force-pushed the js/non-agressive-cosmetic-filters branch 3 times, most recently from e5a6bf2 to be92be8 Compare May 4, 2023 15:38
@cuba cuba marked this pull request as ready for review May 4, 2023 17:32
@cuba cuba requested a review from a team as a code owner May 4, 2023 17:32
@cuba cuba added the QA/Yes label May 4, 2023
@iccub iccub requested a review from Brandon-T May 5, 2023 10:08
@cuba cuba force-pushed the js/non-agressive-cosmetic-filters branch from be92be8 to a01fcc2 Compare May 8, 2023 10:36
@cuba cuba requested review from pes10k and antonok-edm May 8, 2023 13:55
Copy link
Collaborator

@pes10k pes10k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let a requested change for how to correctly resolve URLs

@cuba cuba force-pushed the js/non-agressive-cosmetic-filters branch from a01fcc2 to eb42862 Compare May 10, 2023 14:52
@cuba cuba requested review from pes10k and iccub May 10, 2023 18:47
Copy link
Collaborator

@pes10k pes10k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cuba cuba added this to the 1.52 milestone May 10, 2023
@cuba cuba merged commit b48ac2c into development May 10, 2023
@cuba cuba deleted the js/non-agressive-cosmetic-filters branch May 10, 2023 19:47
iccub pushed a commit that referenced this pull request May 16, 2023
* Add non-aggressive cosmetic filters

Undo

* Make default ad-block level standard

* Fix issue with extracting origin on selectors poller script
iccub pushed a commit that referenced this pull request May 16, 2023
* Add non-aggressive cosmetic filters

Undo

* Make default ad-block level standard

* Fix issue with extracting origin on selectors poller script
@iccub iccub modified the milestones: 1.52, 1.51.1 May 17, 2023
arthuredelstein pushed a commit to brave/brave-core that referenced this pull request Feb 13, 2024
…brave-ios#7333)

* Add non-aggressive cosmetic filters

Undo

* Make default ad-block level standard

* Fix issue with extracting origin on selectors poller script
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow cosmetic filtering script to be non-aggressive (not hide 1st party elements)
4 participants