Merge pull request #124 from bakulf/pb
Disable popup if in PrivateBrowsing
This commit is contained in:
commit
a9a0cc1ba2
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_popup": "popup.html"
|
||||
}
|
||||
},
|
||||
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue