Skip to content

Commit 49c9539

Browse files
committed
Add ability to deactivate sync of parent tab and opener tab
1 parent 634dd84 commit 49c9539

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

webextensions/background/background.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ async function attachTabFromRestoredInfo(aTab, aOptions = {}) {
315315
}
316316
var opener = getOpenerTab(aTab);
317317
if (!attached &&
318-
opener) {
318+
opener &&
319+
configs.syncParentTabAndOpenerTab) {
319320
await attachTabTo(aTab, opener, {
320321
dontExpand: !active,
321322
forceExpand: active,

webextensions/background/handlers.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,9 @@ function handleNewActiveTab(aTab, aInfo = {}) {
556556

557557
function onTabUpdated(aTab) {
558558
var parent = getOpenerTab(aTab);
559-
if (parent && parent != getParentTab(aTab)) {
559+
if (parent &&
560+
parent != getParentTab(aTab) &&
561+
configs.syncParentTabAndOpenerTab) {
560562
attachTabTo(aTab, parent, {
561563
insertAt: kINSERT_NEAREST,
562564
forceExpand: isActive(aTab),
@@ -580,7 +582,8 @@ function onTabCollapsedStateChanged(aTab, aInfo = {}) {
580582

581583
async function onTabAttached(aTab, aInfo = {}) {
582584
var parent = aInfo.parent;
583-
if (aTab.apiTab.openerTabId != parent.apiTab.id) {
585+
if (aTab.apiTab.openerTabId != parent.apiTab.id &&
586+
configs.syncParentTabAndOpenerTab) {
584587
aTab.apiTab.openerTabId = parent.apiTab.id;
585588
aTab.apiTab.TSTUpdatedOpenerTabId = aTab.apiTab.openerTabId; // workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1409262
586589
browser.tabs.update(aTab.apiTab.id, { openerTabId: parent.apiTab.id })
@@ -701,7 +704,8 @@ async function onTabAttached(aTab, aInfo = {}) {
701704
}
702705

703706
function onTabDetached(aTab, aDetachInfo) {
704-
if (aTab.apiTab.openerTabId) {
707+
if (aTab.apiTab.openerTabId &&
708+
configs.syncParentTabAndOpenerTab) {
705709
aTab.apiTab.openerTabId = aTab.apiTab.id;
706710
aTab.apiTab.TSTUpdatedOpenerTabId = aTab.apiTab.openerTabId; // workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1409262
707711
browser.tabs.update(aTab.apiTab.id, { openerTabId: aTab.apiTab.id }) // set self id instead of null, because it requires any valid tab id...

webextensions/common/common.js

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ configs = new Configs({
114114

115115
parentTabBehaviorForChanges: kPARENT_TAB_BEHAVIOR_ALWAYS,
116116

117+
syncParentTabAndOpenerTab: true,
118+
117119

118120
// grouping
119121
autoGroupNewTabs: true,

0 commit comments

Comments
 (0)