Set the openerTabId to a tab that won't be removed/closed
The tab might be removed before we can create the tab making the parent invalid. #1065 - [Feature Request] Pass openerTabId when creating tabs in order to know the parent
This commit is contained in:
parent
7e04c46070
commit
af986e8880
1 changed files with 6 additions and 5 deletions
|
@ -143,7 +143,10 @@ const assignManager = {
|
||||||
|| this.storageArea.isExempted(options.url, tab.id)) {
|
|| this.storageArea.isExempted(options.url, tab.id)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
const removeTab = backgroundLogic.NEW_TAB_PAGES.has(tab.url)
|
||||||
|
|| (messageHandler.lastCreatedTab
|
||||||
|
&& messageHandler.lastCreatedTab.id === tab.id);
|
||||||
|
const openTabId = removeTab ? tab.openerTabId : tab.id;
|
||||||
this.reloadPageInContainer(
|
this.reloadPageInContainer(
|
||||||
options.url,
|
options.url,
|
||||||
userContextId,
|
userContextId,
|
||||||
|
@ -151,7 +154,7 @@ const assignManager = {
|
||||||
tab.index + 1,
|
tab.index + 1,
|
||||||
tab.active,
|
tab.active,
|
||||||
siteSettings.neverAsk,
|
siteSettings.neverAsk,
|
||||||
tab.id
|
openTabId
|
||||||
);
|
);
|
||||||
this.calculateContextMenu(tab);
|
this.calculateContextMenu(tab);
|
||||||
|
|
||||||
|
@ -166,9 +169,7 @@ const assignManager = {
|
||||||
however they don't run on about:blank so this would likely be just as hacky.
|
however they don't run on about:blank so this would likely be just as hacky.
|
||||||
We capture the time the tab was created and close if it was within the timeout to try to capture pages which haven't had user interaction or history.
|
We capture the time the tab was created and close if it was within the timeout to try to capture pages which haven't had user interaction or history.
|
||||||
*/
|
*/
|
||||||
if (backgroundLogic.NEW_TAB_PAGES.has(tab.url)
|
if (removeTab) {
|
||||||
|| (messageHandler.lastCreatedTab
|
|
||||||
&& messageHandler.lastCreatedTab.id === tab.id)) {
|
|
||||||
browser.tabs.remove(tab.id);
|
browser.tabs.remove(tab.id);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Reference in a new issue