1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-10 21:34:13 +01:00

Automagically disable automatic updates for nightlies on FF4.

This commit is contained in:
Kris Maglione
2011-01-18 22:21:21 -05:00
parent 47f98a3a6a
commit e7af89e2c8

28
common/bootstrap.js vendored
View File

@@ -33,6 +33,7 @@ function httpGet(url) {
let initialized = false;
let addon = null;
let addonData = null;
let basePath = null;
let categories = [];
let components = {};
@@ -40,6 +41,26 @@ let resources = [];
let getURI = null;
storage.set("dactyl.bootstrap", this);
function updateVersion() {
try {
function isDev(ver) /^hg|pre$/.test(ver);
if (typeof require === "undefined" || addon === addonData)
return;
require(global, "config");
require(global, "prefs");
config.lastVersion = localPrefs.get("lastVersion", null);
localPrefs.set("lastVersion", addon.version);
if (!config.lastVersion || isDev(config.lastVersion) != isDev(addon.version))
addon.applyBackgroundUpdates = AddonManager[isDev(addon.version) ? "AUTOUPDATE_DISABLE" : "AUTOUPDATE_DEFAULT"];
}
catch (e) {
reportError(e);
}
}
function startup(data, reason) {
dump("dactyl: bootstrap: startup " + reasonToString(reason) + "\n");
basePath = data.installPath;
@@ -49,8 +70,12 @@ function startup(data, reason) {
dump("dactyl: bootstrap: init" + " " + data.id + "\n");
addonData = data;
addon = data;
AddonManager.getAddonByID(addon.id, function (a) { addon = a; });
AddonManager.getAddonByID(addon.id, function (a) {
addon = a;
updateVersion();
});
if (basePath.isDirectory())
getURI = function getURI(path) {
@@ -145,6 +170,7 @@ function init() {
component.register();
Services.obs.notifyObservers(null, "dactyl-rehash", null);
updateVersion();
require(global, "overlay");
}