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

Clear group id in-advance when tab is moved to pinned container #25983

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Oct 15, 2024

Our vertical tab uses CompoundTabContainer.
When tab is moved from the group by pinning, it's moved to
pinned TabContainerImpl before its tab group id is cleared.
And it causes runtime crash as using this tab from pinned TabContainerImpl
has assumption that it's not included in any group.
So, clear in-advance when tab enters to pinned TabContainerImpl.

and BraveTabStripModel::ExecuteContextMenuCommand changes could be deleted now.
When tab is moved by pinning, TabStripModel::MoveTabToIndexImpl clears that tab's group id first from model via contents_data_->MoveTabRecursive(initial_index, final_index, group, pin).
and then moving changes notification is fired. So, we just need to clear Tab's groud id.
Tab::SetData() is somewhat general api that can be called from some other places but
it's good place to clear its group id as pinned tab is not included in group anymore.

This PR is based on @Ilie-Lesan 's PR(#25406).

and I'll f/u this issue in upstream also - https://chromium-review.googlesource.com/c/chromium/src/+/5919961

Resolves brave/brave-browser#40365

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • 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 wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • 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:

VerticalTabStripBrowserTest.PinningGroupedTab

  1. Create three tabs
  2. Create group with existing tabs and there is no pinned tab
  3. Try to pin second tab in the group
  4. No crash

@simonhong simonhong self-assigned this Oct 15, 2024
@simonhong simonhong changed the title Llie/when using vertical tabs pinning a tab that is part of a group crashes the browser Clear group id in-advance when tab is moved to pinned container Oct 15, 2024
Our vertical tab uses CompoundTabContainer.
When tab is moved from the group by pinning, it's moved to
pinned TabContainerImpl before its tab group id is cleared.
And it causes runtime crash as using this tab from pinned TabContainerImpl
has assumption that it's not included in any group.
So, clear in-advance when tab enters to pinned TabContainerImpl.
@simonhong simonhong force-pushed the llie/when-using-vertical-tabs-pinning-a-tab-that-is-part-of-a-group-crashes-the-browser branch from 2e60c1a to 25db86c Compare October 15, 2024 01:53
@simonhong simonhong marked this pull request as ready for review October 15, 2024 03:40
@simonhong simonhong requested a review from a team as a code owner October 15, 2024 03:40
@iefremov
Copy link
Contributor

@simonhong pls make sure to get it uplifted as needed, thanks :)

@simonhong simonhong merged commit 07178bf into master Oct 15, 2024
17 checks passed
@simonhong simonhong deleted the llie/when-using-vertical-tabs-pinning-a-tab-that-is-part-of-a-group-crashes-the-browser branch October 15, 2024 05:28
@github-actions github-actions bot added this to the 1.73.x - Nightly milestone Oct 15, 2024
brave-builds added a commit that referenced this pull request Oct 15, 2024
brave-builds added a commit that referenced this pull request Oct 15, 2024
@simonhong
Copy link
Member Author

@simonhong pls make sure to get it uplifted as needed, thanks :)

Done. uplift PRs for beta/release are ready!

@brave-builds
Copy link
Collaborator

Released in v1.73.12

@Ilie-Lesan
Copy link
Contributor

Ilie-Lesan commented Oct 15, 2024

@simonhong I had a look and everything is fine.

@LaurenWags
Copy link
Member

LaurenWags commented Oct 15, 2024

Verified with

Brave | 1.73.12 Chromium: 130.0.6723.44 (Official Build) nightly (x86_64)
-- | --
Revision | a81b2b1b1225ba78f59753b334af02ab4918b139
OS | macOS Version 14.7 (Build 23H124)

Using STR from #25983 (comment) and 1.73.9 Chromium: 130.0.6723.44, reproduced the crash when pinning second tab in tab group.

Using same STR as above and upgrading the above profile to 1.73.12 Chromium: 130.0.6723.44, confirmed no crash when pinning second tab in tab group.

Also checked STR with a clean profile of 1.73.12 Chromium: 130.0.6723.44 and confirmed no crash when pinning second tab of tab group.

Screen.Recording.2024-10-15.at.2.55.38.PM.mov

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.

When using vertical tabs, pinning a tab that is part of a group crashes the browser - follow up to #40201
6 participants