-
Notifications
You must be signed in to change notification settings - Fork 873
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
Allow multiple capture groups for debounce regex action #14687
Allow multiple capture groups for debounce regex action #14687
Conversation
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.
Instead of manually adding slashes (and potentially adding them at the end where it may not work), why not simply capture one of the slashes in a capture group?
e.g. instead of ^/([^/]+)/s/(.*)$
, we could use ^/([^/]+)/s(/.*)$
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.
Not opposed to the concept. Deferring to François about the regexes. Definitely needs a lot more tests.
0294030
to
88d160e
Compare
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 looks good to me, but someone more familiar with Chromium idioms should check whether that's the best way to concatenate StringPiece
s.
@bridiver any thoughts? https://github.com/brave/brave-core/pull/14687/files#diff-19bb36033aacc98f6f730c5cbda666206d951a19f782c58fca555b7e44765ab3R215 |
88d160e
to
29132b6
Compare
60fdef8
to
319b562
Compare
@@ -212,12 +231,14 @@ bool DebounceRule::Apply(const GURL& original_url, | |||
action_ != kDebounceRegexPath) | |||
return false; | |||
// If URL matches an explicitly excluded pattern, this rule does not apply. | |||
if (exclude_pattern_set_.MatchesURL(original_url)) | |||
if (exclude_pattern_set_.MatchesURL(original_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.
this diff is not needed, existing formatting is acceptable
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 know but I just wanted to match everything up. It helps me a tiny bit when I want to add local logging to have these, and given that they're both equivalent I thought might as well. Personally I think always specifying {} is easier to read, but no strong feelings
@ShivanKaul can you attach testplan please? |
@MadhaviSeelam working on adding a test rule to the debounce.json list, but in the meantime the De-Yandex rules should be sufficient. I've updated the URLs to test in the test plan. |
@MadhaviSeelam updated the test plan with the test rule: https://dev-pages.brave.software/navigation-tracking/debouncing.html, all tests should pass (thanks @pes10k!) |
Resolves brave/brave-browser#24750
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:
The following URLs should get debounced to the publisher URL, once the component update goes out:
https://dev-pages.brave.software/navigation-tracking/debouncing.html, all tests should pass for regression; the one under test is
Regex (multi)