Bootstrapify extension to work for Firefox Nightly 57 SDK removal. Fixes #725
This commit is contained in:
@@ -8,7 +8,6 @@ module.exports = {
|
||||
"backgroundLogic": true,
|
||||
"identityState": true,
|
||||
"messageHandler": true,
|
||||
"tabPageCounter": true,
|
||||
"themeManager": true
|
||||
"tabPageCounter": true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
"js/background/identityState.js",
|
||||
"js/background/messageHandler.js",
|
||||
"js/background/tabPageCounter.js",
|
||||
"js/background/themeManager.js",
|
||||
"js/backdround/init.js"
|
||||
]
|
||||
-->
|
||||
@@ -22,7 +21,6 @@
|
||||
<script type="text/javascript" src="identityState.js"></script>
|
||||
<script type="text/javascript" src="messageHandler.js"></script>
|
||||
<script type="text/javascript" src="tabPageCounter.js"></script>
|
||||
<script type="text/javascript" src="themeManager.js"></script>
|
||||
<script type="text/javascript" src="init.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -80,9 +80,6 @@ const messageHandler = {
|
||||
const port = browser.runtime.connect();
|
||||
port.onMessage.addListener(m => {
|
||||
switch (m.type) {
|
||||
case "lightweight-theme-changed":
|
||||
themeManager.update(m.message);
|
||||
break;
|
||||
case "open-tab":
|
||||
backgroundLogic.openTab(m.message);
|
||||
break;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
const THEME_BUILD_DATE = 20170630;
|
||||
const themeManager = {
|
||||
existingTheme: null,
|
||||
disabled: false,
|
||||
async init() {
|
||||
const browserInfo = await browser.runtime.getBrowserInfo();
|
||||
if (Number(browserInfo.buildID.substring(0, 8)) >= THEME_BUILD_DATE) {
|
||||
this.disabled = true;
|
||||
} else {
|
||||
this.check();
|
||||
}
|
||||
},
|
||||
setPopupIcon(theme) {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
let icons = {
|
||||
16: "img/container-site-d-24.png",
|
||||
32: "img/container-site-d-48.png"
|
||||
};
|
||||
if (theme === "firefox-compact-dark@mozilla.org") {
|
||||
icons = {
|
||||
16: "img/container-site-w-24.png",
|
||||
32: "img/container-site-w-48.png"
|
||||
};
|
||||
}
|
||||
browser.browserAction.setIcon({
|
||||
path: icons
|
||||
});
|
||||
},
|
||||
check() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
browser.runtime.sendMessage({
|
||||
method: "getTheme"
|
||||
}).then((theme) => {
|
||||
this.update(theme);
|
||||
}).catch(() => {
|
||||
throw new Error("Unable to get theme");
|
||||
});
|
||||
},
|
||||
update(theme) {
|
||||
if (this.existingTheme !== theme) {
|
||||
this.setPopupIcon(theme);
|
||||
this.existingTheme = theme;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
themeManager.init();
|
||||
@@ -150,13 +150,18 @@ const Logic = {
|
||||
},
|
||||
|
||||
async identity(cookieStoreId) {
|
||||
const identity = await browser.contextualIdentities.get(cookieStoreId);
|
||||
return identity || {
|
||||
const defaultContainer = {
|
||||
name: "Default",
|
||||
cookieStoreId,
|
||||
icon: "default-tab",
|
||||
color: "default-tab"
|
||||
};
|
||||
// Handle old style rejection with null and also Promise.reject new style
|
||||
try {
|
||||
return await browser.contextualIdentities.get(cookieStoreId) || defaultContainer;
|
||||
} catch(e) {
|
||||
return defaultContainer;
|
||||
}
|
||||
},
|
||||
|
||||
addEnterHandler(element, handler) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Containers Experiment",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
|
||||
"description": "Containers works by isolating cookie jars using separate origin-attributes defined visually by colored ‘Container Tabs’. This add-on is a modified version of the containers feature for Firefox Test Pilot.",
|
||||
"icons": {
|
||||
|
||||
Reference in New Issue
Block a user