1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 19:14:11 +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 initialized = false;
let addon = null; let addon = null;
let addonData = null;
let basePath = null; let basePath = null;
let categories = []; let categories = [];
let components = {}; let components = {};
@@ -40,6 +41,26 @@ let resources = [];
let getURI = null; let getURI = null;
storage.set("dactyl.bootstrap", this); 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) { function startup(data, reason) {
dump("dactyl: bootstrap: startup " + reasonToString(reason) + "\n"); dump("dactyl: bootstrap: startup " + reasonToString(reason) + "\n");
basePath = data.installPath; basePath = data.installPath;
@@ -49,8 +70,12 @@ function startup(data, reason) {
dump("dactyl: bootstrap: init" + " " + data.id + "\n"); dump("dactyl: bootstrap: init" + " " + data.id + "\n");
addonData = data;
addon = data; addon = data;
AddonManager.getAddonByID(addon.id, function (a) { addon = a; }); AddonManager.getAddonByID(addon.id, function (a) {
addon = a;
updateVersion();
});
if (basePath.isDirectory()) if (basePath.isDirectory())
getURI = function getURI(path) { getURI = function getURI(path) {
@@ -145,6 +170,7 @@ function init() {
component.register(); component.register();
Services.obs.notifyObservers(null, "dactyl-rehash", null); Services.obs.notifyObservers(null, "dactyl-rehash", null);
updateVersion();
require(global, "overlay"); require(global, "overlay");
} }