27 lines
756 B
JavaScript
27 lines
756 B
JavaScript
browser.runtime.sendMessage({
|
|
method: "getPreference",
|
|
pref: "browser.privatebrowsing.autostart"
|
|
}).then(pbAutoStart => {
|
|
|
|
// We don't want to disable the addon if we are in auto private-browsing.
|
|
if (!pbAutoStart) {
|
|
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(() => {});
|
|
}
|
|
}).catch(() => {});
|
|
|
|
function disableAddon(tabId) {
|
|
browser.browserAction.disable(tabId);
|
|
browser.browserAction.setTitle({ tabId, title: "Containers disabled in Private Browsing Mode" });
|
|
}
|