Skip to content

Conversation

@KyleKincer
Copy link
Contributor

@KyleKincer KyleKincer commented Nov 10, 2025

I was testing on Twilight and Firefox is aggressively removing tab owners in some cases. These changes attempt to maintain persistent tab owner relationships to enable consistent back-to-close behavior similar to Arc Browser.

Changes

Modified tabbrowser.js in 3 places:

  1. Background tabs now set owner - Ctrl+Click and middle-click tabs maintain owner relationship
    • It seems like this was usually happening anyway despite what this part of the code would suggest. I'm fine with removing this if you think it's unnecessary
  2. Switching tabs preserves owner - Owner no longer cleared when changing tabs
    • If you spawned a new tab then switch tabs around, the owner is lost and back-to-close no longer works.
  3. Related tab chains keep owner - Multiple tabs opened from same source all maintain owner

Testing

  1. Ctrl+Click: Click link with Ctrl → switch to tab → press back → returns to original tab
  2. Multiple tabs: Open several from one page → all can return to that page
  3. Tab switching: Switch tabs multiple times → back still works

b=no-bug, c=tabs

Maintains tab.owner in three key scenarios to ensure back-to-close always returns to the opener tab:

1. Background tab opens (Ctrl+Click, middle-click): Now sets owner even for background tabs
2. Tab switching: Owner no longer cleared when switching between tabs
3. Related tab chains: All tabs in a chain keep their owner

Testing workflow:
- Ctrl+Click link → switch to new tab → press back → should return to original tab
- Open multiple tabs from same page → all should return to that page on back
- Switch between tabs multiple times → back should still work

b=no-bug, c=tabs
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 10, 2025
@KyleKincer KyleKincer changed the title feat: Preserve tab owner for Arc-like back-to-close feat: Preserve tab owner for back-to-close Nov 10, 2025
@dosubot dosubot bot added the Feature label Nov 10, 2025
Copy link
Member

@mr-cheffy mr-cheffy left a comment

Choose a reason for hiding this comment

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

Im not comfortable changing how owners work here since it might even lead to memory leaks. Could you please show me examples or videos where the owner gets reset and it doesn't on arc?

@KyleKincer
Copy link
Contributor Author

Im not comfortable changing how owners work here since it might even lead to memory leaks. Could you please show me examples or videos where the owner gets reset and it doesn't on arc?

Sure. Here are the two main ones that I run into.

  • Issue 1: Navigating to any other page clears the tab owner
issue1.mp4
  • Issue 2: Opening multiple tabs from one parent results in the children having no owner
issue2.mp4

@mr-cheffy
Copy link
Member

I'll move this into #11267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants