Conversation
bdcdf39 to
802bf11
Compare
|
A Storybook has been deployed to preview UI for the latest push |
|
A Storybook has been deployed to preview UI for the latest push |
|
A Storybook has been deployed to preview UI for the latest push |
d31ba6a to
b4c8b5f
Compare
|
A Storybook has been deployed to preview UI for the latest push |
|
A Storybook has been deployed to preview UI for the latest push |
8881250 to
de95d87
Compare
|
A Storybook has been deployed to preview UI for the latest push |
de95d87 to
f5ba907
Compare
|
A Storybook has been deployed to preview UI for the latest push |
f5ba907 to
6da2aa6
Compare
|
A Storybook has been deployed to preview UI for the latest push |
|
A Storybook has been deployed to preview UI for the latest push |
1d3a3c3 to
7a7b371
Compare
fed2070 to
ae695ee
Compare
| // These filters are represented as JSON provided by adblock-rust. The format | ||
| // is documented at: | ||
| // https://docs.rs/adblock/latest/adblock/cosmetic_filter_cache/struct.ProceduralOrActionFilter.html | ||
| void StripProceduralFilters(base::Value::Dict& resources) { |
There was a problem hiding this comment.
Why is this in a separate helper file? If this is just for testing, you should add a friend test so it can be a private method in the adblock service
There was a problem hiding this comment.
or is this to make it accessible to ios?
There was a problem hiding this comment.
We have two other unit-tested helper methods in there too, seemed like it fit with those.
I don't think we have a mockable version of AdBlockService just yet, moving it there would mean we need to use browsertests.
There was a problem hiding this comment.
I guess this is fine for now, but I'm not a fan of exposing these as public methods. Can we at least move it into an internal target and restrict visibility? This should ideally be the case with any classes that shouldn't be used outside the component.
|
[puLL-Merge] - brave/brave-core@24688 DescriptionThis PR introduces support for procedural cosmetic filtering in Brave's ad-blocking engine. It updates the adblock Rust library from version 0.8.12 to 0.9.0 and adds new functionality to handle procedural filters like ChangesChanges
Possible Issues
Security Hotspots
Overall, this PR significantly enhances Brave's ad-blocking capabilities but introduces complexity that requires careful testing and security review, especially around the new JavaScript-based procedural filtering logic. |
757454e to
bfa38f0
Compare
bfa38f0 to
5f555c9
Compare
| // - for cosmetic filters work with CSS and stylesheet. That work itself | ||
| // could call the script several times. | ||
|
|
||
| import { applyCompiledSelector, compileProceduralSelector } from './procedural_filters' |
There was a problem hiding this comment.
@antonok-edm @bridiver
This results in significant increasing the JS inject size to every frame.
I hope you estimated the extra loading delay somehow. Could you share the numbers?
There was a problem hiding this comment.
@atuchin-m to make sure I understand, there's an increase in load times? Does that happen on every page, or only pages with an active filter rule that uses a procedural filter? And does it happen in Standard mode, or also Aggressive mode?
There was a problem hiding this comment.
@ShivanKaul
It add an overhead to any page load (we always inject the script if Shields aren't down)
The script size changed in 2x times:

I don't see any major changes in high-level metrics on the dashboard now, but every such change (+10k JS inject) makes Brave harder to compete against Chrome.
Resolves brave/brave-browser#16935
Please see self-review notes here before reviewing!
Submitter Checklist:
QA/YesorQA/No;release-notes/includeorrelease-notes/exclude;OS/...) to the associated issuenpm run test -- brave_browser_tests,npm run test -- brave_unit_testswikinpm run presubmitwiki,npm run gn_check,npm run tslintgit rebase master(if needed)Reviewer Checklist:
gnAfter-merge Checklist:
changes has landed on
Test Plan:
brave://settings/shields/filters, subscribe to https://antonok.com/tmp/procedural-filter-tests/test-extended-css-rules.txt.Test notes
The tests are from https://testcases.agrd.dev/Filters/extended-css-rules/test-extended-css-rules, with slight modifications to disable autostart. Autostart must be disabled because Brave executes some cosmetic filters with batched operations for performance reasons. The test code runs immediately and synchronously, but those batched operations can occur after the page test logic already declares the tests failed.
Other failures on the test page are expected. Many of the test cases use AdGuard-specific syntax extensions or other features that are not currently supported by this initial implementation - we'll get to those in some followups 😄