Skip to content

Commit 4c33ec3

Browse files
committed
Output more debuggable logs
1 parent eb9f748 commit 4c33ec3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

webextensions/background/commands.js

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export async function bookmarkTree(rootTabs, { parentId, index, showDialog } = {
172172

173173

174174
export async function openNewTabAs(options = {}) {
175+
log('openNewTabAs ', options);
175176
let activeTabs;
176177
if (!options.baseTab) {
177178
activeTabs = await browser.tabs.query({
@@ -184,6 +185,7 @@ export async function openNewTabAs(options = {}) {
184185
}).catch(ApiTabs.createErrorHandler());
185186
}
186187
const activeTab = options.baseTab || Tab.get(activeTabs[0].id);
188+
log('activeTab ', activeTab);
187189

188190
let parent, insertBefore, insertAfter;
189191
let isOrphan = false;

webextensions/background/handle-moved-tabs.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ Tab.onCreated.addListener((tab, info = {}) => {
3939
info.skipFixupTree ||
4040
// do nothing for already attached tabs
4141
(tab.openerTabId &&
42-
tab.$TST.parent == Tab.get(tab.openerTabId))))
42+
tab.$TST.parent == Tab.get(tab.openerTabId)))) {
43+
log('skip to fixup tree for replaced/duplicated/restored tab ', tab, info);
4344
return;
45+
}
4446
// if the tab is opened inside existing tree by someone, we must fixup the tree.
4547
if (!(info.positionedBySelf ||
4648
info.movedBySelfWhileCreation) &&
@@ -49,13 +51,17 @@ Tab.onCreated.addListener((tab, info = {}) => {
4951
(info.treeForActionDetection &&
5052
info.treeForActionDetection.target &&
5153
(info.treeForActionDetection.target.next ||
52-
info.treeForActionDetection.target.previous))))
54+
info.treeForActionDetection.target.previous)))) {
5355
tryFixupTreeForInsertedTab(tab, {
5456
toIndex: tab.index,
5557
fromIndex: Tab.getLastTab(tab.windowId).index,
5658
treeForActionDetection: info.treeForActionDetection,
5759
isTabCreating: true
5860
});
61+
}
62+
else {
63+
log('no need to fixup tree for newly created tab ', tab, info);
64+
}
5965
});
6066

6167
Tab.onMoving.addListener((tab, moveInfo) => {

0 commit comments

Comments
 (0)