Addon enabled when PB is by default
This commit is contained in:
parent
1de7e0f593
commit
1df3d841af
2 changed files with 31 additions and 10 deletions
12
index.js
12
index.js
|
@ -29,6 +29,7 @@ const { attachTo } = require("sdk/content/mod");
|
||||||
const { ContextualIdentityService } = require("resource://gre/modules/ContextualIdentityService.jsm");
|
const { ContextualIdentityService } = require("resource://gre/modules/ContextualIdentityService.jsm");
|
||||||
const { getFavicon } = require("sdk/places/favicon");
|
const { getFavicon } = require("sdk/places/favicon");
|
||||||
const { modelFor } = require("sdk/model/core");
|
const { modelFor } = require("sdk/model/core");
|
||||||
|
const prefService = require("sdk/preferences/service");
|
||||||
const self = require("sdk/self");
|
const self = require("sdk/self");
|
||||||
const { Style } = require("sdk/stylesheet/style");
|
const { Style } = require("sdk/stylesheet/style");
|
||||||
const tabs = require("sdk/tabs");
|
const tabs = require("sdk/tabs");
|
||||||
|
@ -77,6 +78,7 @@ const ContainerService = {
|
||||||
"createIdentity",
|
"createIdentity",
|
||||||
"removeIdentity",
|
"removeIdentity",
|
||||||
"updateIdentity",
|
"updateIdentity",
|
||||||
|
"getPreference",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Map of identities.
|
// Map of identities.
|
||||||
|
@ -548,6 +550,16 @@ const ContainerService = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Preferences
|
||||||
|
|
||||||
|
getPreference(args) {
|
||||||
|
if (!("pref" in args)) {
|
||||||
|
return Promise.reject("getPreference must be called with pref argument.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve(prefService.get(args.pref));
|
||||||
|
},
|
||||||
|
|
||||||
// Styling the window
|
// Styling the window
|
||||||
|
|
||||||
configureWindows() {
|
configureWindows() {
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
browser.tabs.onCreated.addListener(tab => {
|
browser.runtime.sendMessage({
|
||||||
if (tab.incognito) {
|
method: "getPreference",
|
||||||
disableAddon(tab.id);
|
pref: "browser.privatebrowsing.autostart"
|
||||||
}
|
}).then(pbAutoStart => {
|
||||||
});
|
|
||||||
|
|
||||||
browser.tabs.query({}).then(tabs => {
|
// We don't want to disable the addon if we are in auto private-browsing.
|
||||||
for (let tab of tabs) { // eslint-disable-line prefer-const
|
if (!pbAutoStart) {
|
||||||
if (tab.incognito) {
|
browser.tabs.onCreated.addListener(tab => {
|
||||||
disableAddon(tab.id);
|
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(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue