Skip to content

Commit 7e04c46

Browse files
LoveIsGriefLoveIsGrief
authored andcommitted
Pass the openerTabId when automatically opening tabs in containers
the `openerTabId` can also be seen as the tab's parent. This is useful for extensions like https://github.com/piroor/treestyletab #1065 - [Feature Request] Pass openerTabId when creating tabs in order to know the parent
1 parent 166420d commit 7e04c46

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/js/background/assignManager.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ const assignManager = {
144144
return {};
145145
}
146146

147-
this.reloadPageInContainer(options.url, userContextId, siteSettings.userContextId, tab.index + 1, tab.active, siteSettings.neverAsk);
147+
this.reloadPageInContainer(
148+
options.url,
149+
userContextId,
150+
siteSettings.userContextId,
151+
tab.index + 1,
152+
tab.active,
153+
siteSettings.neverAsk,
154+
tab.id
155+
);
148156
this.calculateContextMenu(tab);
149157

150158
/* Removal of existing tabs:
@@ -350,13 +358,13 @@ const assignManager = {
350358
});
351359
},
352360

353-
reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false) {
361+
reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false, openerTabId = null) {
354362
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
355363
const loadPage = browser.extension.getURL("confirm-page.html");
356364
// False represents assignment is not permitted
357365
// If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there
358366
if (neverAsk) {
359-
browser.tabs.create({url, cookieStoreId, index, active});
367+
browser.tabs.create({url, cookieStoreId, index, active, openerTabId});
360368
} else {
361369
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
362370
let currentCookieStoreId;
@@ -367,6 +375,7 @@ const assignManager = {
367375
browser.tabs.create({
368376
url: confirmUrl,
369377
cookieStoreId: currentCookieStoreId,
378+
openerTabId,
370379
index,
371380
active
372381
}).then(() => {

0 commit comments

Comments
 (0)