cleanup
This commit is contained in:
parent
384ac486d9
commit
c3da573722
2 changed files with 19 additions and 19 deletions
|
@ -113,12 +113,12 @@ const backgroundLogic = {
|
||||||
return list.concat(containerState.hiddenTabs);
|
return list.concat(containerState.hiddenTabs);
|
||||||
},
|
},
|
||||||
|
|
||||||
async unhideContainer(cookieStoreId, toHide) {
|
async unhideContainer(cookieStoreId, alreadyShowingUrl) {
|
||||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||||
this.unhideQueue.push(cookieStoreId);
|
this.unhideQueue.push(cookieStoreId);
|
||||||
await this.showTabs({
|
await this.showTabs({
|
||||||
cookieStoreId,
|
cookieStoreId,
|
||||||
toHide
|
alreadyShowingUrl
|
||||||
});
|
});
|
||||||
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ const backgroundLogic = {
|
||||||
|
|
||||||
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
||||||
// do not show already opened url
|
// do not show already opened url
|
||||||
if (object.url !== options.toHide) {
|
if (object.url !== options.alreadyShowingUrl) {
|
||||||
promises.push(this.openNewTab({
|
promises.push(this.openNewTab({
|
||||||
userContextId: userContextId,
|
userContextId: userContextId,
|
||||||
url: object.url,
|
url: object.url,
|
||||||
|
|
|
@ -153,25 +153,25 @@ const messageHandler = {
|
||||||
!tab.url.startsWith("moz-extension")) {
|
!tab.url.startsWith("moz-extension")) {
|
||||||
// increment the counter of container tabs opened
|
// increment the counter of container tabs opened
|
||||||
this.incrementCountOfContainerTabsOpened();
|
this.incrementCountOfContainerTabsOpened();
|
||||||
}
|
|
||||||
|
|
||||||
this.tabUpdateHandler = (tabId, changeInfo) => {
|
this.tabUpdateHandler = (tabId, changeInfo) => {
|
||||||
if (tabId === tab.id && changeInfo.status === "complete") {
|
if (tabId === tab.id && changeInfo.status === "complete") {
|
||||||
// get current tab's url to not open the same one from hidden tabs
|
// get current tab's url to not open the same one from hidden tabs
|
||||||
browser.tabs.get(tabId).then(loadedTab => {
|
browser.tabs.get(tabId).then(loadedTab => {
|
||||||
backgroundLogic.unhideContainer(tab.cookieStoreId, loadedTab.url);
|
backgroundLogic.unhideContainer(tab.cookieStoreId, loadedTab.url);
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
|
|
||||||
browser.tabs.onUpdated.removeListener(this.tabUpdateHandler);
|
browser.tabs.onUpdated.removeListener(this.tabUpdateHandler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// if it's a container tab wait for it to complete and
|
||||||
|
// unhide other tabs from this container
|
||||||
|
if (tab.cookieStoreId.startsWith("firefox-container")) {
|
||||||
|
browser.tabs.onUpdated.addListener(this.tabUpdateHandler);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// if it's a container tab wait for it to complete and
|
|
||||||
// unhide other tabs from this container
|
|
||||||
if (tab.cookieStoreId.startsWith("firefox-container")) {
|
|
||||||
browser.tabs.onUpdated.addListener(this.tabUpdateHandler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue