-
Notifications
You must be signed in to change notification settings - Fork 936
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 removeparam
#15943
Support removeparam
#15943
Conversation
Is this meant to replace the existing query filter? If so, we should make sure it passes the existing browser tests: https://github.com/brave/brave-core/blob/c7a229c7eb8a0c2ad4d2d799c3a7eac2a19da541/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc |
@antonok-edm Can you point to the PR implementing the URL rewriting on the Rust side? |
1628fce
to
936cd62
Compare
@fmarier it's currently in brave/adblock-rust#235 (I will merge that and set the |
87a8533
to
825902f
Compare
825902f
to
999adc1
Compare
999adc1
to
80ac71f
Compare
961843f
to
04b2956
Compare
Just noting that the answer for this PR is no. This is adding support for custom lists and rules in order to get parity with uBlock Origin. Using this support to migrate the existing query string filter to a list will be done in a separate PR. |
@@ -110,7 +110,8 @@ class AdBlockService { | |||
bool* did_match_rule, | |||
bool* did_match_exception, | |||
bool* did_match_important, | |||
std::string* mock_data_url); | |||
std::string* mock_data_url, | |||
std::string* rewritten_url); |
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.
i think we should stop adding new params to this method and introduce a structure instead. Otherwise, it goes out of control - there is no single line of comment describing what is for what, and every new change touches a dozen of irrelevant files
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.
cc @bridiver
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.
Ideally we just need brave/brave-browser#5461, which I'm hoping to get to soon:tm:
or definitely at least before adding any further arguments to these methods
CancelDeferredNavigation(content::NavigationThrottle::ThrottleCheckResult( | ||
content::NavigationThrottle::CANCEL)); | ||
|
||
const GURL new_url(new_url_spec); |
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.
need to check if the url is valid
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
|
||
if (ctx->method == "GET" || ctx->method == "HEAD" || | ||
ctx->method == "OPTIONS") { | ||
ctx->new_url_spec = rewritten_url; |
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.
check validity of the url?
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.
Would it also be worth checking that the scheme is HTTP/HTTPS?
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
@fmarier I think we want it to be able to apply to WS/WSS as well. But anyways, unsupported schemes are already not even passed to the adblock engine so it should be alright here.
04b2956
to
aa1bf3c
Compare
// technically this is a new navigation | ||
params.redirect_chain.clear(); | ||
|
||
base::SequencedTaskRunnerHandle::Get()->PostTask( |
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.
this approach to filtering is potentially suboptimal, but we can keep it as is as long the filter list consists of really small set of entries
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 What did you have in mind in term of a "really small set of entries"?
Here's an example list a user could add: https://github.com/AdguardTeam/FiltersRegistry/blob/master/filters/filter_17_TrackParam/filter.txt
aa1bf3c
to
b1f03d4
Compare
Verification PASSED on
Using the STR/Cases outlined via #15943 (comment), went through the following:
|
Resolves brave/brave-browser#23927
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:
Save the following document as
index.html
and serve it using your preferred method (e.g.python -m http.server
).Add a custom rule to
brave://settings/shields/filters
corresponding to the location the HTML document is served from. For example,localhost:8000^$document,removeparam=test
(modifylocalhost:8000
as necessary based on your hosting endpoint). Save the custom rules.Open the page you served in a new tab of the browser. There are 3 links on the page. Click on each one in order and observe the following query string in the URL bar, as well as on the first line of the page:
?test2=false
?test2=false