brave-core icon indicating copy to clipboard operation
brave-core copied to clipboard

Fixed redundant creation of Default profile

Open spylogsster opened this issue 2 years ago • 3 comments

Resolves https://github.com/brave/brave-browser/issues/4599

Fixed redundant creation of default profile. GetPrimaryUserProfile returns Default browser profile, but not the profile which is currently used by user. If user has deleted Default profile it will be re-created in this case. Better to use LastUsedProfile which returns current profile for the user.

Submitter Checklist:

  • [x] I confirm that no security/privacy review is needed, or that I have requested one
  • [x] There is a ticket for my issue
  • [x] Used Github auto-closing keywords in the PR description above
  • [x] Wrote a good PR/commit description
  • [x] Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • [x] Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • [x] 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
  • [x] Ran git rebase master (if needed)

Reviewer Checklist:

  • [x] A security review is not needed, or a link to one is included in the PR description
  • [x] New files have MPL-2.0 license header
  • [x] Adequate test coverage exists to prevent regressions
  • [x] Major classes, functions and non-trivial code blocks are well-commented
  • [x] Changes in component dependencies are properly reflected in gn
  • [x] Code follows the style guide
  • [x] Test plan is specified in PR before merging

After-merge Checklist:

  • [ ] The associated issue milestone is set to the smallest version that the changes has landed on
  • [ ] All relevant documentation has been updated, for instance:
    • [ ] https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove)
    • [ ] https://github.com/brave/brave-browser/wiki/Proxy-redirected-URLs
    • [ ] https://github.com/brave/brave-browser/wiki/Fingerprinting-Protections
    • [ ] https://github.com/brave/brave-browser/wiki/Brave%E2%80%99s-Use-of-Referral-Codes
    • [ ] https://github.com/brave/brave-browser/wiki/Custom-Headers
    • [ ] https://github.com/brave/brave-browser/wiki/Web-Compatibility-Exceptions-in-Brave
    • [ ] https://github.com/brave/brave-browser/wiki/QA-Guide
    • [ ] https://github.com/brave/brave-browser/wiki/P3A

Test Plan:

  • Start a clean profile
  • Click on people icon and click on Manage people
  • Add a new person in Manage people window
  • Click on Person 2 window and click on people icon, lists Person 1 in the list
  • In manage people window, click on 3 dots of Person 1 and delete it
  • Open Person 2 window and click on people icon, still lists Person 1 there. Clicking that will create a new Person 1 window

spylogsster avatar Jun 23 '22 15:06 spylogsster

Changes LGTM! ++

@DJAndries how do things look for you? This would be a great fix to land if everything is OK

looks good! will do a smoke test today

DJAndries avatar Jun 29 '22 16:06 DJAndries

Also, has anyone seen this stack trace when exiting the browser?

The crash goes away if I remove OnProfileManagerDestroying from AdBlockSubscriptionDownloadManagerGetter. This does not occur on master. Interesting side effect.

DJAndries avatar Jun 29 '22 22:06 DJAndries

Also, has anyone seen this stack trace when exiting the browser?

The crash goes away if I remove OnProfileManagerDestroying from AdBlockSubscriptionDownloadManagerGetter. This does not occur on master. Interesting side effect.

fixed

spylogsster avatar Jul 04 '22 19:07 spylogsster