Too many tabs.onMoved event fired when a tab group is moved to a new window
Categories
(WebExtensions :: General, defect)
Tracking
(firefox139 fixed)
| Tracking | Status | |
|---|---|---|
| firefox139 | --- | fixed |
People
(Reporter: robwu, Assigned: robwu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(2 files)
While working on extra test coverage for the tabGroups.move API, I discovered that the tabs.onMoved event fires too frequently when a tab group is moved to a new window. There are multiple reasons for that:
-
TabMoveis fired whenever the tab group changes.adoptTabGroupadopts tabs by first moving tabs from another window, then adopting tabs in the tab group. Consequently, there is always a transition between tab groups, and tabs.onMoved is fired for each tab in the group. -
When
adoptTabGroupadopts tabs, it puts all tabs at the front of the specified destination. Consequently, tabs appear in reverse order before finally being moved to its destination. This final move may trigger additionalTabMoveevents, and therefore alsotabs.move. -
The implementation of
tabGroups.movefirst adopts tab groups at the end of a window, and then moves it to its destination. This all will triggertabs.onMovedevents.
| Assignee | ||
Comment 1•7 months ago
|
||
This patch covers multiple cases:
-
Pre-existing issue: adoptTabGroup adopts tabs by first moving the tabs
elsewhere, then moving it into a group. When moved into a group,
TabMove is fired, which previously translated to tabs.onMoved. That
would result in too much event noise. -
When tabGroups.move is called, it first adopted the tab group in
another window, and then moved the tab group as a whole. This
results in unnecessary tabs.onMoved events too. The fix is to specify
the desired position at once to adoptTabGroup.
Updated•7 months ago
|
| Assignee | ||
Comment 2•7 months ago
|
||
Updated•7 months ago
|
Comment 4•7 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/18acdfacc01b
https://hg.mozilla.org/mozilla-central/rev/52abc36a8c48
Description
•