Skip to content
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

Drop patch for profile_io_data.cc and use chromium_src instead #7995

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

mariospr
Copy link
Contributor

@mariospr mariospr commented Feb 18, 2021

The idea of this patch was simply to make sure that the brave://
scheme gets considered by ProfileIOData::IsHandledProtocol() along
with other schemes, but we can achieve the same goal just using
chromium_src overrides, so let's do that instead.

Fixes brave/brave-browser#14238

Submitter Checklist:

  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)
  • Requested a security/privacy review as needed

Reviewer Checklist:

  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

See Test plan from #1196

@mariospr mariospr added this to the 1.22.x - Nightly milestone Feb 18, 2021
@mariospr mariospr requested a review from a team as a code owner February 18, 2021 11:30
@mariospr mariospr self-assigned this Feb 18, 2021
return IsHandledProtocol_ChromiumImpl(scheme);
}

bool ProfileIOData::IsHandledURL(const GURL& url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't quite follow what this is for

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsHandledProtocol() is referenced from the body of IsHandledURL() in this profile_io_data.cc file, and thus the renaming via #define IsHandledProtocol IsHandledProtocol_ChromiumImpl done above this lines also changes that line inside IsHandledURL()'s body.

Therefore, I understand that we need to provide our own version of IsHandledURL() as well to make sure that we get our own version of IsHandledProtocol() called when invoked via IsHandledURL(), no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, I just didn't look into what's happening in IsHandledURL(). Probably worth adding a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, comment added. Will merge once CI finishes running again. Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method seems to be missing

  if (!url.is_valid()) {
    // We handle error cases.
    return true;
  }

I am a bit hesitant about replacing methods in this way: if the original method is further modified we'd never know.

Copy link
Contributor Author

@mariospr mariospr Feb 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method seems to be missing

if (!url.is_valid()) {
// We handle error cases.
return true;
}

Oops! True, added now.

I am a bit hesitant about replacing methods in this way: if the original method is further modified we'd never know.

I share the same concern to be honest. In the other hand, I think this risk already exists in other overrides since renaming a symbol via define will change not just the name of the method in its definition, but also any callpoint inside the same .cc file. That is, imagine another that we already have where we rename an internal method that was originally not called from any other point in that .cc file, and then upstream decides to reference it at some point from another method in that file: our override might not be correct now since that newly added callpoint would now be invoking the unmodified logic, not ours... and we don't have an easy way to detect that, I think?

Now back to this particular case, I did check what git blame had to say about IsHandledURL() and found this:

672c8c1e10e9b ([email protected]      2013-03-07 12:30:06 +0000 279) // static
a8c1e745a571a ([email protected]      2011-05-14 06:17:07 +0000 280) bool ProfileIOData::IsHandledURL(const GURL& url) {
a8c1e745a571a ([email protected]      2011-05-14 06:17:07 +0000 281)   if (!url.is_valid()) {
a8c1e745a571a ([email protected]      2011-05-14 06:17:07 +0000 282)     // We handle error cases.
a8c1e745a571a ([email protected]      2011-05-14 06:17:07 +0000 283)     return true;
a8c1e745a571a ([email protected]      2011-05-14 06:17:07 +0000 284)   }

That is, it seems that the last time this IsHandledURL() method was modified was 10 years ago, so perhaps the risk in this particular case is low.

@mkarolin WDYT?

PS: FWIW, I'm not pushing for this to be done, I'm happy to go back to having a .patch and re-think how to get rid about it (or keep it), just mentioning this because it was the reasoning I followed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, not a strong concern.

@mariospr mariospr force-pushed the issues/14238 branch 4 times, most recently from 5c0869c to 5c534f3 Compare February 19, 2021 16:23
@mariospr
Copy link
Contributor Author

@brave/patch-reviewers Looks like I still need a review from you, PTAL when you have a moment, thanks!

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

The idea of this patch was simply to make sure that the brave://
scheme gets considered by ProfileIOData::IsHandledProtocol() along
with other schemes, but we can achieve the same goal just using
chromium_src overrides, so let's do that instead.

Fixes brave/brave-browser#14238
@mariospr
Copy link
Contributor Author

The failure in the post-init CI bot is unrelated to this PR and this can be safely merged now, so doing it now. Thanks!

@mariospr mariospr merged commit 5c07f58 into master Feb 23, 2021
@mariospr mariospr deleted the issues/14238 branch February 23, 2021 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove patches/chrome-browser-profiles-profile_io_data.cc.patch
3 participants