start containerTabsOpened counter
This commit is contained in:
parent
a7be3c9935
commit
4e6eee220c
1 changed files with 20 additions and 0 deletions
|
@ -112,6 +112,14 @@ const messageHandler = {
|
|||
// lets remember the last tab created so we can close it if it looks like a redirect
|
||||
this.lastCreatedTab = tab;
|
||||
if (tab.cookieStoreId) {
|
||||
// Don't count firefox-default, firefox-private, nor our own confirm page loads
|
||||
if (tab.cookieStoreId !== "firefox-default" &&
|
||||
tab.cookieStoreId !== "firefox-private" &&
|
||||
tab.url.indexOf("confirm-page.html") === -1) {
|
||||
// increment the counter of container tabs opened
|
||||
this.incrementCountOfContainerTabsOpened();
|
||||
}
|
||||
|
||||
this.unhideContainer(tab.cookieStoreId);
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
@ -120,6 +128,18 @@ const messageHandler = {
|
|||
});
|
||||
},
|
||||
|
||||
async incrementCountOfContainerTabsOpened() {
|
||||
const key = "containerTabsOpened";
|
||||
const count = await browser.storage.local.get(key);
|
||||
let countOfContainerTabsOpened = count[key];
|
||||
if (countOfContainerTabsOpened === null) {
|
||||
countOfContainerTabsOpened = 1;
|
||||
} else {
|
||||
countOfContainerTabsOpened += 1;
|
||||
}
|
||||
browser.storage.local.set({[key]: countOfContainerTabsOpened});
|
||||
},
|
||||
|
||||
async unhideContainer(cookieStoreId) {
|
||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||
this.unhideQueue.push(cookieStoreId);
|
||||
|
|
Loading…
Add table
Reference in a new issue