Disable popup if in PrivateBrowsing #124
This commit is contained in:
@@ -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"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user