diff --git a/bootstrap.js b/bootstrap.js index e70670d..cf21b76 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -130,41 +130,58 @@ async function install() { } // eslint-disable-next-line no-unused-vars -async function uninstall(aData, aReason) { - if (aReason === ADDON_UNINSTALL - || aReason === ADDON_DISABLE) { - const config = await getConfig(); - const storedPrefs = config.savedConfiguration.prefs || {}; - PREFS.forEach((pref) => { - let value = pref.default; - if (pref.name in storedPrefs) { - value = storedPrefs[pref.name]; - } - if ("int" === pref.type) { - Services.prefs.setIntPref(pref.name, value); - } else { - Services.prefs.setBoolPref(pref.name, value); - } - }); +async function uninstall({resourceURI}, aReason) { + if (checkLegacyFirefox()) { + if (aReason === ADDON_UNINSTALL) { + unloadStyles(resourceURI); + await removeChanges(); + } } } +async function removeChanges() { + const config = await getConfig(); + const storedPrefs = config.savedConfiguration.prefs || {}; + PREFS.forEach((pref) => { + let value = pref.default; + if (pref.name in storedPrefs) { + value = storedPrefs[pref.name]; + } + if ("int" === pref.type) { + Services.prefs.setIntPref(pref.name, value); + } else { + Services.prefs.setBoolPref(pref.name, value); + } + }); +} + +function checkLegacyFirefox() { + const version = Services.appinfo.version; + const versionMatch = version.match(/^([0-9]+)\./)[1]; + if (Number(versionMatch) <= 56) { + return true; + } + return false; +} + // eslint-disable-next-line no-unused-vars function startup({webExtension, resourceURI}) { - const version = Services.appinfo.version; - const versionMatch = version.match(/^([0-9]+)\./)[1]; - if (versionMatch === "55" - || versionMatch === "56") { + if (checkLegacyFirefox()) { loadStyles(resourceURI); + // Reset prefs that may have changed, or are legacy + install(); } - // Reset prefs that may have changed, or are legacy - install(); // Start the embedded webextension. webExtension.startup(); } // eslint-disable-next-line no-unused-vars -function shutdown({resourceURI}) { - unloadStyles(resourceURI); +function shutdown({resourceURI}, aReason) { + if (checkLegacyFirefox()) { + unloadStyles(resourceURI); + if (aReason === ADDON_DISABLE) { + removeChanges(); + } + } } diff --git a/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.1.zip b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.1.zip new file mode 100644 index 0000000..29d1fa3 Binary files /dev/null and b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.1.zip differ diff --git a/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.5.zip b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.5.zip new file mode 100644 index 0000000..a137886 Binary files /dev/null and b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.5.zip differ diff --git a/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.6.zip b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.6.zip new file mode 100644 index 0000000..3912d7e Binary files /dev/null and b/webextension/web-ext-artifacts/firefox_multi-account_containers-4.0.6.zip differ diff --git a/webextension/web-ext-artifacts/mozilla_containers-3.1.1.zip b/webextension/web-ext-artifacts/mozilla_containers-3.1.1.zip new file mode 100644 index 0000000..ef9dd43 Binary files /dev/null and b/webextension/web-ext-artifacts/mozilla_containers-3.1.1.zip differ diff --git a/webextension/web-ext-artifacts/multi-account_containers-4.0.2.zip b/webextension/web-ext-artifacts/multi-account_containers-4.0.2.zip new file mode 100644 index 0000000..5d8e97a Binary files /dev/null and b/webextension/web-ext-artifacts/multi-account_containers-4.0.2.zip differ