The issue here is in on_drop.
When the action is `GROUP_DROP_ACTION_CREATE` and we have `dropIndex` we move the dragged tab before we call `gBrowser.addTabGroup`
in this case `groupTab` index is no longer valid.
The fix is simply to assign `groupTab` before we move any tab.
```diff
this._finishAnimateTabMove();
+ let groupTab = this.allTabs[groupDropIndex];
if (groupDropAction == GROUP_DROP_ACTION_APPEND) {
- let groupTab = this.allTabs[groupDropIndex];
groupTab.group.addTabs(movingTabs);
} else if (dropIndex !== false) {
for (let tab of movingTabs) {
gBrowser.moveTabTo(tab, dropIndex);
if (incrementDropIndex) {
dropIndex++;
}
}
}
if (groupDropAction == GROUP_DROP_ACTION_CREATE) {
- let groupTab = this.allTabs[groupDropIndex];
gBrowser.addTabGroup([groupTab, ...movingTabs], {
insertBefore: draggedTab,
showCreateUI: true,
color: draggedTab._dragData.tabGroupCreationColor,
});
}
}
```
Bug 1932594 Comment 6 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The issue here is in on_drop.
When the action is `GROUP_DROP_ACTION_CREATE` and we have `dropIndex` we move the dragged tab before we call `gBrowser.addTabGroup`
in this case `groupTab` index is no longer valid.
The fix is simply to assign `groupTab` before we move any tab.
```diff
this._finishAnimateTabMove();
+ let groupTab = this.allTabs[groupDropIndex];
if (groupDropAction == GROUP_DROP_ACTION_APPEND) {
- let groupTab = this.allTabs[groupDropIndex];
groupTab.group.addTabs(movingTabs);
} else if (dropIndex !== false) {
for (let tab of movingTabs) {
gBrowser.moveTabTo(tab, dropIndex);
if (incrementDropIndex) {
dropIndex++;
}
}
}
if (groupDropAction == GROUP_DROP_ACTION_CREATE) {
- let groupTab = this.allTabs[groupDropIndex];
gBrowser.addTabGroup([groupTab, ...movingTabs], {
insertBefore: draggedTab,
showCreateUI: true,
color: draggedTab._dragData.tabGroupCreationColor,
});
}
}
```
you can also apply `gBrowser.addTabGroup([groupTabFixed, ...movingTabs].sort((a,b) => a._tPos - b._tPos)` to fix bug 1933210