-
Notifications
You must be signed in to change notification settings - Fork 871
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
Same site query filter #6609
Same site query filter #6609
Conversation
df6c3a3
to
709d20b
Compare
7ca8158
to
e7ed618
Compare
e7ed618
to
0a6800d
Compare
} | ||
|
||
if (ctx->redirect_source.is_valid()) { | ||
if (ctx->internal_redirect) { |
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.
isn't ctx->internal_redirect
always false if we have good redirect_source
?
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.
No, because we generate 307
s as a result of the query filter for example. If we don't filter those out here, we end up looking at these requests twice.
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 mean that redirect_source
is set to a non-empty value only if ctx->internal_redirect
is false, and it seems that ctx->internal_redirect
cannot change to true
afterwards without changing ctx->redirect_source
. This way, if ctx->redirect_source
is non-empty, ctx->internal_redirect
should be false
Am I wrong?
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 believe you're right, as long as we keep these in sync.
<body> | ||
<p>Waiting for JS redirect...</p> | ||
<script> | ||
setTimeout(redirectToDestination, 100); |
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.
curious why do we need this?
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.
That's to simulate a navigation, as opposed to a redirect. Another way I could have done this would have been to include a link and then inject JS to click the link programmatically.
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.
100ms is pretty noticeable dealy even for browsertests, so I'd suggest to change if we can avoid it
browser/net/brave_site_hacks_network_delegate_helper_unittest.cc
Outdated
Show resolved
Hide resolved
browser/net/brave_site_hacks_network_delegate_helper_unittest.cc
Outdated
Show resolved
Hide resolved
browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc
Outdated
Show resolved
Hide resolved
browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc
Outdated
Show resolved
Hide resolved
browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc
Outdated
Show resolved
Hide resolved
LGTM with small nits. I'll rebase my #6674 on top of this one after it gets merged |
0a6800d
to
7ebccaf
Compare
7ebccaf
to
cc3e7cf
Compare
// Same-site redirects are exempted. | ||
return; | ||
} | ||
} else if (net::registry_controlled_domains::SameDomainOrHost( |
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.
maybe we also can shorten the code by chosing something like source_url
conditionally?
if (...) {source_url = ctx->redirect_source;}
else if (...) {source_url = ctx->initiator_url;}
if (net::registry_controlled_domains::SameDomainOrHost(source_url, ctx->request_url, ...) {
return;
}
I updated the documentation on the wiki: https://github.com/brave/brave-browser/wiki/Query-String-Filter/_compare/ac55a85c8e44c91e16bdbe5fb2a82ceab1af271c...9ea0443624df53f34b0265568ee2c82f8c4e6acf |
For some reason, GitHub didn't show me your comments and only showed me your approval (I found out catching up on emails). Sorry for merging without addressing these first. |
Resolves brave/brave-browser#9020
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
All of the test cases on https://fmarier.github.io/brave-testing/query-filter.html should work as described on there.
Reviewer Checklist:
After-merge Checklist:
changes has landed on.