@@ -98,7 +98,7 @@ export async function createTabInPanel(panel: Panel, conf?: browser.tabs.CreateP
98
98
99
99
const tabShell = { fromNewTabButton : true } as Tab
100
100
let index = Tabs . getIndexForNewTab ( panel , tabShell )
101
- const parentId = Tabs . getParentForNewTab ( panel , true )
101
+ const parentId = Tabs . getParentForNewTab ( panel , tabShell )
102
102
if ( ! Utils . isTabsPanel ( panel ) ) return
103
103
if ( index === undefined && panel . nextTabIndex > - 1 ) index = panel . nextTabIndex
104
104
@@ -803,18 +803,21 @@ function getIndexForNewTabOtherCases(
803
803
return fallbackIndex
804
804
}
805
805
806
+ interface ParentForNewTabConf {
807
+ openerTabId ?: ID
808
+ fromNewTabButton ?: boolean
809
+ }
810
+
806
811
/**
807
812
* Find and return parent id
808
813
*/
809
- export function getParentForNewTab (
810
- panel : Panel ,
811
- fromNewTabButton : boolean ,
812
- openerTabId ?: ID
813
- ) : ID | undefined {
814
+ export function getParentForNewTab ( panel : Panel , conf ?: ParentForNewTabConf ) : ID | undefined {
814
815
const activeTab = Tabs . byId [ Tabs . activeId ]
815
816
817
+ const openerTabId = conf && conf . openerTabId
816
818
let parent : Tab | undefined
817
819
if ( openerTabId ) parent = Tabs . byId [ openerTabId ]
820
+ const fromNewTabButton = conf ? conf . fromNewTabButton : false
818
821
819
822
// Place new tab opened from pinned tab
820
823
if ( parent && parent . pinned ) return
0 commit comments