question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable CosmeticFilteringJsPerformance by default

See original GitHub issue

The feature was implemented in https://github.com/brave/brave-browser/issues/25614 Cosmetic in child frames now is enabled by griffin in https://github.com/brave/brave-variations/pull/466 Now the feature should be enabled with the recommended parameters. Slack thread: https://bravesoftware.slack.com/archives/C01LKMP6X36/p1668103608663869

Steps to verify:

  1. Cosmetic filtering should works as before, nothing should be changed. For sites with a lot of DOM changes another algorithm is used, but the results should be the same.
  2. Child frames + Speedometer2 score: Enabling/disabling flag BraveAdblockCosmeticFilteringChildFrames shouldn’t affect the score on https://browserbench.org/Speedometer2.0/. Pplease take into account that local results will have some deviations.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
atuchin-mcommented, Dec 2, 2022

The added elements simulate some unwanted ads and the custom rules simulate adblock files rules.

So if you have those custom rules them all the added element should be hidden. If you don’t have the rules: they should be visible.

0reactions
stephendonnercommented, Dec 11, 2022

Verified PASSED using

Brave 1.47.123 Chromium: 108.0.5359.99 (Official Build) beta (x86_64)
Revision 410951fc34bb4b2cbf182231f9f779efaafaf682-refs/branch-heads/5359_71@{#9}
OS macOS Version 13.1 (Build 22C65)

Cosmetic filtering not enabled - PASSED

  1. install 1.47.123
  2. launch Brave
  3. open example.com
  4. open dev tools console
  5. run the script in step 3 from https://github.com/brave/brave-browser/issues/26861#issuecomment-1335605869
  6. wait till Done! Scroll to the end to check if there is any visible new element is shown in the console appears

Confirmed dynamically added elements aren’t blocked

example example example
Screenshot 2022-12-11 at 9 39 10 AM Screenshot 2022-12-11 at 9 37 45 AM Screenshot 2022-12-11 at 9 38 06 AM

Cosmetic filtering enabled - PASSED

continue from Case 1

  1. open brave://adblock and add following: ##.blocked-class-1 ##.blocked-class-2 ##.blocked-class-3
  2. refresh example.com site
  3. open dev tools
  4. run the script in step 3 from https://github.com/brave/brave-browser/issues/26861#issuecomment-1335605869
  5. wait till Done! Scroll to the end to check if there is any visible new element is shown in the console message appears

Confirmed dynamically added elements are blocked

example example
Screenshot 2022-12-11 at 9 20 01 AM Screenshot 2022-12-11 at 9 19 39 AM

Child frames + Speedometer2 score - PASSED

`Enabled`
  1. open brave://flags
  2. enable #brave-adblock-cosmetic-filtering-child-frames
  3. visit https://browserbench.org/Speedometer2.0/
  4. click Start Test
run 1 run 2 run 3
Screenshot 2022-12-11 at 9 49 02 AM Screenshot 2022-12-11 at 9 49 44 AM Screenshot 2022-12-11 at 9 50 25 AM

Disabled

  1. open brave://flags
  2. disable #brave-adblock-cosmetic-filtering-child-frames
  3. visit https://browserbench.org/Speedometer2.0/
  4. click Start Test
run 1 run 2 run 3
Screenshot 2022-12-11 at 9 53 42 AM Screenshot 2022-12-11 at 9 54 33 AM Screenshot 2022-12-11 at 9 55 15 AM
Read more comments on GitHub >

github_iconTop Results From Across the Web

Procedural cosmetic filters · gorhill/uBlock Wiki - GitHub
Regular cosmetic filters are declarative, i.e., they are used as a selector in a CSS rule and handled by browsers through style tag...
Read more >
Not all adblockers are born equal - Tech @ Cliqz
js . Cosmetic Filters. Cosmetic filters are not triggered by requests, but modify pages (or frames, to be precise). Their targeting logic is ......
Read more >
Third-party cosmetic filtering - Brave Browser
Our approach is to make a best-effort, runtime decision about whether a cosmetic filter list rule would hide only third-party advertisement ...
Read more >
uBlock Origin: The Ultimate Review and Guide
uBO provides two powerful tools to allow users to perform “cosmetic filtering.” These tools are the Element Zapper and the Element Picker.
Read more >
[Support] uBlock Origin - Mozilla Discourse
Check settings or popup panel for “Disable cosmetic filtering” option. ... may try experimental scriptlet example.com##script:inject(overlay-buster.js) .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found