Skip to content

Fix race condition hiding tabs moved between windows and mutex leak#175

Open
duncanplatt wants to merge 1 commit intophotodiode:masterfrom
duncanplatt:tab-fix
Open

Fix race condition hiding tabs moved between windows and mutex leak#175
duncanplatt wants to merge 1 commit intophotodiode:masterfrom
duncanplatt:tab-fix

Conversation

@duncanplatt
Copy link
Contributor

Fix race condition hiding tabs moved between windows and mutex leak

Firefox 148 landed sync about:blank (Bug 543435), which changed tab adoption timing and introduced a race between the onAttached and onActivated event handlers. When a tab is dragged between windows, activated() could call toggleVisibleTabs before attached() finished updating the tab's groupId, causing the moved tab to be hidden.

Three issues fixed in addon.tabs.events.js:

  1. activated() now persists the corrected groupId when it detects the active tab's group doesn't exist in the current window. Previously the fallback was only used locally for that one toggleVisibleTabs call, so the tab would be re-hidden on the next activation.

  2. attached() now explicitly shows the tab after reassigning its group, recovering visibility if a racing toggleVisibleTabs already hid it.

Also fixed in addon.tabGroups.js:

  1. setActiveId() returned early without releasing the mutex when the group was not found, which would deadlock all subsequent group operations (create, query, update, remove).

Refs: Firefox Bug 543435, Bug 1987344, Bug 2002643
Refs: #173

Fix race condition hiding tabs moved between windows and mutex leak

Firefox 148 landed sync about:blank (Bug 543435), which changed tab
adoption timing and introduced a race between the onAttached and
onActivated event handlers. When a tab is dragged between windows,
activated() could call toggleVisibleTabs before attached() finished
updating the tab's groupId, causing the moved tab to be hidden.

Three issues fixed in addon.tabs.events.js:

1. activated() now persists the corrected groupId when it detects the
   active tab's group doesn't exist in the current window. Previously
   the fallback was only used locally for that one toggleVisibleTabs
   call, so the tab would be re-hidden on the next activation.

2. attached() now explicitly shows the tab after reassigning its group,
   recovering visibility if a racing toggleVisibleTabs already hid it.

Also fixed in addon.tabGroups.js:

3. setActiveId() returned early without releasing the mutex when the
   group was not found, which would deadlock all subsequent group
   operations (create, query, update, remove).

Refs: Firefox Bug 543435, Bug 1987344, Bug 2002643
Refs: photodiode#173
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.

1 participant