-
Notifications
You must be signed in to change notification settings - Fork 909
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
Support exception rules in the custom filters box of brave://adblock #7666
Conversation
213db10
to
22bbba5
Compare
22bbba5
to
09f5b1a
Compare
std::string* mock_data_url); | ||
bool* did_match_important, | ||
std::string* mock_data_url, | ||
bool previously_matched_rule, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input parameters should precede output ones
https://google.github.io/styleguide/cppguide.html#Inputs_and_Outputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here and in brave/adblock-rust-ffi#31, will fix doneDEPS
here once that's merged
std::string* mock_data_url) override; | ||
bool* did_match_important, | ||
std::string* mock_data_url, | ||
bool previously_matched_rule, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact I don't qute follow why do we need these arguments.
- The signature already is quite crowded
- Adding "previous" state to the function logic doesn't look like a good design
- The core user of this API (
ShouldBlockAdOnTaskRunner
) just passes stub values - this means that these parameters just shouldn't exist in this API
Can we do "previous" check outside the function calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iefremov the "previous" values are used to avoid redundant filter matching logic within adblock-rust
, e.g. it's unnecessary to check for a matching basic filter if we've already found an exception filter from another engine as it will never have any effect. I pulled the important
logic outside the function calls since that can short circuit the entirety of the rest of the matching process.
(As a side note, I agree that it would be much better to have these all kept internal to adblock-rust
, but the current multi-engine approach means we're limited to this for now. I do have an issue open for combining the engines, but that will require some major refactoring.)
I'm not sure what you mean by 3), could you give an example of how that would be avoided?
is it possible to add tests for this? |
@iefremov I did add some tests in the |
fe2a3c1
to
312bc3c
Compare
4c95387
to
7e5c911
Compare
To reiterate: we should keep the facade API (aka |
7e5c911
to
28803e2
Compare
@iefremov I gave it one more try with inout parameters - the style guide says to prefer other solutions but I think this is one of the cases where it makes sense as it simplifies the multi-engine logic significantly. |
28803e2
to
bd1a6e9
Compare
Resolves brave/brave-browser#5440
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed).Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on.
Test Plan:
Verify that no ads appear on https://knowyourmeme.com using default Shields settings.
Then, add the following line to the Custom Filters box of
brave://adblock
:Return to https://knowyourmeme.com/ and force a refresh of the page. There should be new (possibly blank) banner ad spots on the page within one or two page loads.