/usr/share/xul-ext/downthemall/modules/version.jsm is in xul-ext-downthemall 2.0.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /* You may find the license in the LICENSE file */
const EXPORTED_SYMBOLS = ['Version'];
const Cc = Components.classes;
const Ci = Components.interfaces;
const module = Components.utils.import;
const ID = '{DDC359D1-844A-42a7-9AA1-88A850A938A8}';
const runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo).QueryInterface(Ci.nsIXULRuntime);
const comparator = Cc["@mozilla.org/xpcom/version-comparator;1"].getService(Ci.nsIVersionComparator);
let _callbacks = [];
const Version = {
TOPIC_SHOWABOUT: "DTA:showAbout",
ID: ID,
LOCALE: Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale('global'),
APP_NAME: runtime.name.toLowerCase().replace(/ /, ''),
OS: runtime.OS.toLowerCase(),
APP_VERSION: runtime.version,
APP_ID: runtime.ID,
VERSION: '0.0',
BASE_VERSION: '0.0',
NAME: 'DownThemAll!',
moz1: false,
moz2: false,
ready: false,
showAbout: null,
compareVersion: function(version, cmp) {
if (!cmp) {
[version, cmp] = [this.VERSION, version];
}
return comparator.compare(version, cmp);
},
getInfo: function(callback) {
if (this.ready) {
callback.call(callback, this);
}
else {
_callbacks.push(callback);
}
}
};
function completeVersion(addon) {
if (addon) {
Version.VERSION = addon.version;
Version.BASE_VERSION = Version.VERSION.replace(/^([\d\w]+\.[\d\w]+).*?$/, '$1');
Version.NAME = addon.name;
Version.ready = true;
}
_callbacks.forEach(function(c) c.call(c, Version));
_callbacks = [];
}
/**
* Compares two version literals according to mozilla rules
* @param version (string) Optional. Version. If not given extension version will be used.
* @param cmp (string) Version to compare to.
* @return nsIVersionComparator result
*/
try {
// moz-1.9.3+
module("resource://gre/modules/AddonManager.jsm");
Version.moz2 = true;
AddonManager.getAddonByID(Version.ID, function(addon) {
completeVersion(addon);
});
}
catch (ex) {
// moz-1.9.2-
Version.moz1 = true;
const ITEM = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager).getItemForID(ID);
completeVersion(ITEM);
}
|