Bug 747428 - Set additional webapp metadata for use by Windows' uninstall widget. r=tabraldes

This commit is contained in:
Marco Castelluccio 2013-08-26 15:04:50 -04:00
parent 167b155f51
commit 342af815e2

View File

@ -115,6 +115,7 @@ NativeApp.prototype = {
categories: null,
webappJson: null,
runtimeFolder: null,
manifest: null,
/**
* This function reads and parses the data from the app
@ -125,7 +126,8 @@ NativeApp.prototype = {
*
*/
init: function(aData, aManifest) {
let manifest = new ManifestHelper(aManifest, aData.app.origin);
let manifest = this.manifest = new ManifestHelper(aManifest,
aData.app.origin);
let origin = Services.io.newURI(aData.app.origin, null, null);
@ -144,10 +146,16 @@ NativeApp.prototype = {
catch (ex) {}
}
if (manifest.developer && manifest.developer.name) {
let devName = sanitize(manifest.developer.name.substr(0, 128));
if (devName) {
this.developerName = devName;
if (manifest.developer) {
if (manifest.developer.name) {
let devName = sanitize(manifest.developer.name.substr(0, 128));
if (devName) {
this.developerName = devName;
}
}
if (manifest.developer.url) {
this.developerUrl = manifest.developer.url;
}
}
@ -234,11 +242,17 @@ NativeApp.prototype = {
*/
function WinNativeApp(aData) {
NativeApp.call(this, aData);
if (aData.isPackage) {
this.size = aData.app.updateManifest.size / 1024;
}
this._init();
}
WinNativeApp.prototype = {
__proto__: NativeApp.prototype,
size: null,
/**
* Install the app in the system
@ -469,6 +483,28 @@ WinNativeApp.prototype = {
subKey.writeStringValue("DisplayIcon", this.iconFile.path);
}
let date = new Date();
let year = date.getYear().toString();
let month = date.getMonth();
if (month < 10) {
month = "0" + month;
}
let day = date.getDate();
if (day < 10) {
day = "0" + day;
}
subKey.writeStringValue("InstallDate", year + month + day);
if (this.manifest.version) {
subKey.writeStringValue("DisplayVersion", this.manifest.version);
}
if (this.developerName) {
subKey.writeStringValue("Publisher", this.developerName);
}
subKey.writeStringValue("URLInfoAbout", this.developerUrl);
if (this.size) {
subKey.writeIntValue("EstimatedSize", this.size);
}
subKey.writeIntValue("NoModify", 1);
subKey.writeIntValue("NoRepair", 1);
} catch(ex) {