Disable popup if in PrivateBrowsing #124
This commit is contained in:
parent
9b505a2c7d
commit
152cd27c3f
2 changed files with 22 additions and 1 deletions
18
webextension/background.js
Normal file
18
webextension/background.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
browser.tabs.onCreated.addListener(tab => {
|
||||||
|
if (tab.incognito) {
|
||||||
|
disableAddon(tab.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.tabs.query({}).then(tabs => {
|
||||||
|
for (let tab of tabs) { // eslint-disable-line prefer-const
|
||||||
|
if (tab.incognito) {
|
||||||
|
disableAddon(tab.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => {});
|
||||||
|
|
||||||
|
function disableAddon(tabId) {
|
||||||
|
browser.browserAction.disable(tabId);
|
||||||
|
browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
|
||||||
|
}
|
|
@ -32,6 +32,9 @@
|
||||||
},
|
},
|
||||||
"default_title": "Containers",
|
"default_title": "Containers",
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"background": {
|
||||||
|
"scripts": ["background.js"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue