31
const addonID = "{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}";
35
E("version").value = abp.getInstalledVersion();
37
33
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
38
34
if (typeof AddonManager != "undefined")
40
let addon = AddonManager.getAddonByID(addonID, function(addon)
36
let addon = AddonManager.getAddonByID(Utils.addonID, function(addon)
42
loadInstallManifest(addon.getResourceURI("install.rdf"));
38
loadInstallManifest(addon.getResourceURI("install.rdf"), addon.name, addon.homepageURL);
47
43
let extensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
48
let installLocation = extensionManager.getInstallLocation(addonID);
49
let installManifestFile = installLocation.getItemFile(addonID, "install.rdf");
50
loadInstallManifest(ioService.newFileURI(installManifestFile));
44
let rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
45
let root = rdf.GetResource("urn:mozilla:item:" + Utils.addonID);
47
function emResource(prop)
49
return rdf.GetResource("http://www.mozilla.org/2004/em-rdf#" + prop);
52
function getTarget(prop)
54
let target = extensionManager.datasource.GetTarget(root, emResource(prop), true);
56
return target.QueryInterface(Ci.nsIRDFLiteral).Value;
61
let installLocation = extensionManager.getInstallLocation(Utils.addonID);
62
let installManifestFile = installLocation.getItemFile(Utils.addonID, "install.rdf");
63
loadInstallManifest(ioService.newFileURI(installManifestFile), getTarget("name"), getTarget("homepageURL"));
54
function loadInstallManifest(installManifestURI)
67
function loadInstallManifest(installManifestURI, name, homepage)
56
69
let rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
57
70
let ds = rdf.GetDataSource(installManifestURI.spec);
74
87
function dataSourceLoaded()
76
setContributors(getTargets("contributor"), getTargets("translator"));
89
setExtensionData(name, getTargets("version")[0],
90
homepage, getTargets("creator"),
91
getTargets("contributor"), getTargets("translator"));
79
94
if (ds instanceof Ci.nsIRDFRemoteDataSource && ds.loaded)
109
function setContributors(contributors, translators)
124
function setExtensionData(name, version, homepage, authors, contributors, translators)
126
authors.sort(cmpNoCase);
111
127
contributors.sort(cmpNoCase);
112
128
translators.sort(cmpNoCase);
114
E("developers").textContent = contributors.join(", ");
130
E("title").value = name;
131
E("version").value = version;
132
E("homepage").value = homepage;
133
E("authors").textContent = authors.join(", ");
134
E("contributors").textContent = contributors.join(", ");
115
135
E("translators").textContent = translators.join(", ");
117
137
let request = new XMLHttpRequest();