Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adblocking added via right-click context menu to be editable under the brave://adblock "Custom filters" section #9581

Closed
antonok-edm opened this issue May 1, 2020 · 1 comment · Fixed by brave/brave-core#8156

Comments

@antonok-edm
Copy link
Collaborator

antonok-edm commented May 1, 2020

Followup on #8914 and #9577

The right-click cosmetic filtering menu is a useful feature, but uses a different system than the one for custom adblock rules. It should be updated to append new cosmetic filter rules to the custom filters box on brave://adblock.

Any existing element hides added using the right-click method should be migrated to the custom filters box on the first startup of the browser after this change is implemented. Those can be turned into cosmetic filter rules fairly trivially - i.e. <domain>##<CSS selector>. The old cosmetic filtering logic (minus the right-click menu) can then be removed completely as in brave/brave-core#5099.

@antonok-edm antonok-edm changed the title Update right-click cosmetic filtering backend to use brave://adblock custom filters Update adblocking added via right-click context menu to be editable under the brave://adblock "Custom filters" section Mar 5, 2021
@antonok-edm antonok-edm added this to the 1.23.x - Nightly milestone Mar 11, 2021
@stephendonner stephendonner added the QA/In-Progress Indicates that QA is currently in progress for that particular issue label Mar 12, 2021
@stephendonner
Copy link

stephendonner commented Mar 12, 2021

Verified PASSED on nightly using the testplan from brave/brave-core#8156

Brave 1.23.36 Chromium: 89.0.4389.86 (Official Build) nightly (x86_64)
Revision 0c2dac31bc21e806a791641316e99920f84ea52c-refs/branch-heads/4389@{#1472}
OS macOS Version 11.2.3 (Build 20D91)

Migration

Using a previous browser version (I used 1.21.76):

  1. Visit brave://adblock in a new tab
  2. Add some text of your choice to the "Custom filters" box

Screen Shot 2021-03-12 at 10 26 26 AM

I added:

SupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidocious

1234567890
foo
facebook.com
https://www.cnn.com
!@#$%^&*()_+
  1. Visit a website of your choice

aol.com and twitch.tv

  1. Right-click on a page element of your choice
  2. Select "Brave > Block element via selector"
  3. Confirm the block
  4. Repeat steps 3-6 a few times to block a variety of items through the legacy system. Block multiple items on the same page at least once. Keep track of what is being blocked.
aol.com (1.21.76) twitch.tv (1.21.76)
Screen Shot 2021-03-12 at 10 10 40 AM Screen Shot 2021-03-12 at 10 25 13 AM

Then, testing the same profile after the upgrade (1.23.36):

  1. Visit brave://adblock in a new tab
  2. Verify that any text previously added to the "Custom filters" box is still present
  3. Verify that new lines have been added to the "Custom filters" box, including one corresponding to each item previously blocked using the right click menu

Screen Shot 2021-03-12 at 10 39 18 AM

  1. Revisit some of the websites and confirm that any previously blocked items are still hidden
aol.com (1.23.36) twitch.tv (1.23.36)
Screen Shot 2021-03-12 at 12 19 10 PM Screen Shot 2021-03-12 at 10 40 02 AM

Adding new filters

Just on the new version (1.23.36):

  1. Visit a website of your choice

yahoo.com

  1. Right-click on a page element of your choice
  2. Select "Brave > Block element via selector"
  3. Confirm the block
  4. Verify that the blocked item is hidden, and remains hidden after a page refresh
  5. Reopen or refresh brave://adblock and verify that a new line has been added corresponding to the newly blocked item
  6. Repeat steps 1-6 at least one more time
yahoo.com (blocked elements) brave://adblock rules
Screen Shot 2021-03-12 at 12 21 11 PM Screen Shot 2021-03-12 at 12 22 52 PM

Reference Images (no blocked items)

aol.com twitch.tv yahoo.com
Screen Shot 2021-03-12 at 12 30 29 PM Screen Shot 2021-03-12 at 12 30 41 PM Screen Shot 2021-03-12 at 12 23 21 PM

Verification passed on

Brave | 1.23.56 Chromium: 89.0.4389.105 (Official Build) dev (64-bit)
-- | --
Revision | 14f44e21a9d539cd49c72468a29bfca4fa43f710-refs/branch-heads/4389_90@{#7}
OS | Windows 10 OS Version 2004 (Build 19041.867)

Custom filters box
image

aol.com (1.22.52) twitch.tv (1.22.52)
image image

After upgrading to 1.23.x

image

Revisit some of the websites and confirm that any previously blocked items are still hidden

aol.com (1.23.x) twitch.tv (1.23.x)
image image

Adding new filters

Just on the new version (1.23.x):

  1. Visit a website of your choice
cnn.com (blocked elements) brave://adblock rules
image image

Reference Images (no blocked items)
image


Verified passed with

Brave	1.23.68 Chromium: 90.0.4430.51 (Official Build) (64-bit)
Revision	32e5fa33a31641bded70a90e60121060691e7125-refs/branch-heads/4430@{#927}
OS	Linux

Verified test plan from brave/brave-core#8156 (comment)

Migration (Upgrade)

Using a previous browser version (I used 1.22.71):

  1. Visit brave://adblock in a new tab
  2. Add some text of your choice to the "Custom filters" box

I added:

SupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidocious

1234567890
foo
facebook.com
https://www.cnn.com
!@#$%^&*()_+
  1. Visit a website of your choice

aol.com, twitch.tv, twitter.com

  1. Right-click on a page element of your choice
  2. Select "Brave > Block element via selector"
  3. Confirm the block
  4. Repeat steps 3-6 a few times to block a variety of items through the legacy system. Block multiple items on the same page at least once. Keep track of what is being blocked.

Then, testing the same profile after the upgrade (1.23.68):

  1. Visit brave://adblock in a new tab
  2. Verify that any text previously added to the "Custom filters" box is still present
  3. Verify that new lines have been added to the "Custom filters" box, including one corresponding to each item previously blocked using the right click menu
  4. Revisit some of the websites and confirm that any previously blocked items are still hidden
    • On aol.com, blocked horoscope box on right side, AOL logo in top left, search bar at top of page, and search button at top of page
    • On twitch.tv blocked "Join" box on from left nav menu
    • On twitter.com blocked the logo in middle of page, "Sign up" text on button, "Sign up" button

brave://adblock comparison before and after upgrade

1.22.71 1.23.68
pre-upgrade adblock page 1 22 71 post-upgrade adblock page

Site comparison before and after upgrade

1.22.71 1.23.68 no blocked items for comparison
aol com - multiple items-1 22 71 aol com 1 23 68 Screen Shot 2021-04-08 at 10 09 26 AM
twitch tv-one item-1 22 71 twitch tv 1 23 68 Screen Shot 2021-04-08 at 10 09 38 AM
twitter com-2 items-1 22 71 twitter com 1 23 68 Screen Shot 2021-04-08 at 10 09 48 AM
Just adding new filters (Clean profile)
  1. Visit a website of your choice

nytimes.com

  1. Right-click on a page element of your choice
  2. Select "Brave > Block element via selector"
  3. Confirm the block
  4. Verify that the blocked item is hidden, and remains hidden after a page refresh
  5. Reopen or refresh brave://adblock and verify that a new line has been added corresponding to the newly blocked item
  6. Repeat steps 1-6 at least one more time
No blocked items Blocked items brave://adblock page
no blocked items blocked items adblock page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment