brave / brave-browser

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

Custom adblock rules should allow cosmetic filters #4348

Closed srirambv closed 4 years ago

srirambv commented 5 years ago

Test plan

See https://github.com/brave/brave-core/pull/4700

Description

Custom adblock rules doesn't work

Steps to Reproduce

  1. Install 0.64.x build
  2. Add a custom rule for a site in brave://adblock
  3. Visit the page for which the custom rule was added, doesn't block [Detailed STR on https://github.com/brave/brave-core/pull/3121]

Actual result:

Custom adblock rule doesn't work. Element is still loaded after adding the rule

Expected result:

Should block elements based on custom rule

Reproduces how often:

Easy

Brave version (brave://version info)

Brave 0.64.72 Chromium: 74.0.3729.131 (Official Build) beta(64-bit)
Revision 518a41c1fa7ce1c8bb5e22346e82e42b4d76a96f-refs/branch-heads/3729@{#954}
OS Linux

Version/Channel Information:

rebron commented 5 years ago

cc: @Snuupy can you take a look?

Brave-Matt commented 5 years ago

+1 also encountering this

emerick commented 5 years ago

@srirambv Can you provide one or more sample rules that don't work and/or screenshots?

srirambv commented 5 years ago

@emerick Here's the screenshot on latest nightly. I've added the custom adblock rule ##.header-ad using element class name. Even after adding the rule and clean reload of the page/relaunch of browser the ad doesn't get blocked.

Screenshot from 2019-05-27 13-19-38 Screenshot from 2019-05-27 13-19-43

Brave 0.67.62 Chromium: 75.0.3770.38 (Official Build)nightly (64-bit)
Revision 3860105745f2b12537da9e9f048f14c3f52ba970-refs/branch-heads/3770@{#618}
OS Linux

cc: @snyderp

bbondy commented 5 years ago

I think maybe the title should say custom adblock filters should allow you to add cosmetic filters?

tbergeron commented 5 years ago

So the way I understand it, there's currently NO way of blocking any custom element using UI nor the custom filters in brave://adblock right?

If you need another example, just try blocking ANYTHING on reddit. It just don't work at all.

I tried:

reddit.com##.promotedlink
reddit.com#?#div.promotedlink
reddit.com#?#.size-compact.Post:-abp-has([class*=promoted])

Version 0.64.77 Chromium: 74.0.3729.169 (Official Build) (64-bit) on Linux. With JavaScript turned OFF by default (Reddit IS white-listed)

bsclifton commented 5 years ago

@tbergeron that is correct - there is currently no way to block UI elements

@Snuupy is working through several issues related to UI element blocking which are tracked here: https://github.com/brave/brave-browser/projects/21

srirambv commented 5 years ago

cc: @ryanbr

pes10k commented 5 years ago

This is not really in @ryanbr's purview at the moment, since we don't have the ability to apply cosmetic filters at all, and @ryanbr is working on improving issues with existing adblocking capabilities.

Hopefully we'll have this worked out over the summer though, with @Snuupy 's work or someone else who will be joining us for the summer

petemill commented 5 years ago

Fixed via https://github.com/brave/brave-core/pull/3121

btlechowski commented 5 years ago

I am still able to repro the issue. I cannot block elements through brave://adblock cc @srirambv can you quickly recheck this one?

Steps used:

  1. Clean install
  2. Go to http://reddit.com/
  3. Disable shields
  4. Go to brave://adblock
  5. Add rule ##.promotedlink or reddit.com##.promotedlink

Note: Blocking through Block element by selector works as expected.

Brave 0.69.129 Chromium: 77.0.3865.90 (Official Build) (64-bit)
Revision 58c425ba843df2918d9d4b409331972646c393dd-refs/branch-heads/3865@{#830}
OS Ubuntu 18.04 LTS
srirambv commented 5 years ago

@btlechowski verified custom rules are not blocking elements. Verified on

Brave 0.69.130 Chromium: 77.0.3865.90 (Official Build) (64-bit)
Revision 58c425ba843df2918d9d4b409331972646c393dd-refs/branch-heads/3865@{#830}
OS Linux
bsclifton commented 5 years ago

I don't think this issue was actually addressed with https://github.com/brave/brave-core/pull/3121

This issue is covering the brave://adblock page and being able to add cosmetic filters there; the PR was updating functionality in the right click menu

Re-opening and removing milestone

yousefamar commented 4 years ago

After scratching my head over why my filters weren't working, I finally found this issue. It looks like the project this issue was added to (https://github.com/brave/brave-browser/projects/21) has been closed. Does this mean that there are no plans to make the box in brave://adblock do anything? If so, shouldn't it be removed so others can avoid the confusion I went through? And does this mean that the only way to add custom filters is by installing a 3rd party extension?

pes10k commented 4 years ago

@yousefamar currently that field works for network rules, not cosmetic rules. However, once this lands you can enable cosmetic rules behind a flag too

https://github.com/brave/brave-core/pull/3303

After that gets tested we will start exploring ways we can enable cosmetic blocking by default

bsclifton commented 4 years ago

Updated to 1.7 because https://github.com/brave/brave-core/pull/4772 hasn't been merged (yet). Updating the milestone back to 1.6 is in the post-merge checklist for uplifts

srirambv commented 4 years ago

Verification passed on

Brave 1.7.82 Chromium: 80.0.3987.162 (Official Build) dev (64-bit)
Revision f2c5dd6138153bb0658091205bd1a1717f16081a-refs/branch-heads/3987@{#1034}
OS Windows 10 OS Version 1803 (Build 17134.523)

Verified passed with

Brave 1.7.86 Chromium: 80.0.3987.163 (Official Build) (64-bit)
Revision e7fbe071abe9328cdce4ffedac9822435fbd3656-refs/branch-heads/3987@{#1037}
OS macOS Version 10.14.6 (Build 18G3020)

Verified passed with

Brave 1.7.86 Chromium: 80.0.3987.163 (Official Build) (64-bit)
Revision e7fbe071abe9328cdce4ffedac9822435fbd3656-refs/branch-heads/3987@{#1037}
OS Ubuntu 18.04 LTS