Bootstrapify extension to work for Firefox Nightly 57 SDK removal. Fixes #725

This commit is contained in:
Jonathan Kingston
2017-08-13 21:49:57 +01:00
parent 78b5de3b44
commit d685a58d74
10 changed files with 150 additions and 1002 deletions
-2
View File
@@ -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();