Disable popup if in PrivateBrowsing #124

This commit is contained in:
baku 2017-01-28 09:16:00 +01:00
parent 9b505a2c7d
commit 152cd27c3f
2 changed files with 22 additions and 1 deletions

View 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" });
}

View file

@ -32,6 +32,9 @@
},
"default_title": "Containers",
"default_popup": "popup.html"
}
},
"background": {
"scripts": ["background.js"]
}
}