Skip to content

Commit

Permalink
Early return
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 7, 2024
1 parent d0e94a4 commit 5fb466a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions webextensions/background/handle-moved-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@ Tab.onMoving.addListener((tab, moveInfo) => {
const win = TabsStore.windows.get(tab.windowId);
const isNewlyOpenedTab = win.openingTabs.has(tab.id);
const positionControlled = configs.insertNewChildAt != Constants.kINSERT_NO_CONTROL;
if (isNewlyOpenedTab &&
!moveInfo.byInternalOperation &&
!moveInfo.alreadyMoved &&
!moveInfo.isSubstantiallyMoved &&
positionControlled) {
const opener = tab.$TST.openerTab;
// if there is no valid opener, it can be a restored initial tab in a restored window
// and can be just moved as a part of window restoration process.
if (opener) {
log('onTabMove for new child tab: move back '+moveInfo.toIndex+' => '+moveInfo.fromIndex);
moveBack(tab, moveInfo);
return false;
}
}
return true;
if (!isNewlyOpenedTab ||
!positionControlled ||
moveInfo.byInternalOperation ||
moveInfo.alreadyMoved ||
moveInfo.isSubstantiallyMoved)
return true;

// if there is no valid opener, it can be a restored initial tab in a restored window
// and can be just moved as a part of window restoration process.
if (!tab.$TST.openerTab)
return true;

log('onTabMove for new child tab: move back '+moveInfo.toIndex+' => '+moveInfo.fromIndex);
moveBack(tab, moveInfo);
return false;
});

async function tryFixupTreeForInsertedTab(tab, moveInfo = {}) {
Expand Down

0 comments on commit 5fb466a

Please sign in to comment.