Bug 384925 - Allow PFS to return hashes for plugin XPIs, r=doron

This commit is contained in:
benjamin@smedbergs.us 2007-06-19 09:12:49 -07:00
parent 0b85a560e2
commit c2d1a0445c
3 changed files with 28 additions and 16 deletions

View File

@ -109,27 +109,31 @@ nsRDFItemUpdater.prototype = {
target = child;
}
function getPFSValueFromRDF(aValue, aDatasource, aRDFService){
var rdfs = this._rdfService;
function getPFSValueFromRDF(aValue){
var rv = null;
var myTarget = aDatasource.GetTarget(target, aRDFService.GetResource(PFS_NS + aValue), true);
var myTarget = aDatasource.GetTarget(target, rdfs.GetResource(PFS_NS + aValue), true);
if (myTarget)
rv = myTarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
return rv;
}
pluginInfo = new Object();
pluginInfo.name = getPFSValueFromRDF("name", aDatasource, this._rdfService);
pluginInfo.pid = getPFSValueFromRDF("guid", aDatasource, this._rdfService);
pluginInfo.version = getPFSValueFromRDF("version", aDatasource, this._rdfService);
pluginInfo.IconUrl = getPFSValueFromRDF("IconUrl", aDatasource, this._rdfService);
pluginInfo.XPILocation = getPFSValueFromRDF("XPILocation", aDatasource, this._rdfService);
pluginInfo.InstallerShowsUI = getPFSValueFromRDF("InstallerShowsUI", aDatasource, this._rdfService);
pluginInfo.manualInstallationURL = getPFSValueFromRDF("manualInstallationURL", aDatasource, this._rdfService);
pluginInfo.requestedMimetype = getPFSValueFromRDF("requestedMimetype", aDatasource, this._rdfService);
pluginInfo.licenseURL = getPFSValueFromRDF("licenseURL", aDatasource, this._rdfService);
pluginInfo.needsRestart = getPFSValueFromRDF("needsRestart", aDatasource, this._rdfService);
pluginInfo = {
name: getPFSValueFromRDF("name"),
pid: getPFSValueFromRDF("guid"),
version: getPFSValueFromRDF("version"),
IconUrl: getPFSValueFromRDF("IconUrl"),
XPILocation: getPFSValueFromRDF("XPILocation"),
XPIHash: getPFSValueFromRDF("XPIHash"),
InstallerShowsUI: getPFSValueFromRDF("InstallerShowsUI"),
manualInstallationURL: getPFSValueFromRDF("manualInstallationURL"),
requestedMimetype: getPFSValueFromRDF("requestedMimetype"),
licenseURL: getPFSValueFromRDF("licenseURL"),
needsRestart: getPFSValueFromRDF("needsRestart")
};
}
catch (ex){}
}

View File

@ -43,12 +43,15 @@ var PluginInstallService = {
pluginPidArray: null,
startPluginInsallation: function (aPluginXPIUrlsArray, aPluginPidArray) {
startPluginInstallation: function (aPluginXPIUrlsArray,
aPluginHashes,
aPluginPidArray) {
this.pluginPidArray = aPluginPidArray;
var xpiManager = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
.createInstance(Components.interfaces.nsIXPInstallManager);
xpiManager.initManagerFromChrome(aPluginXPIUrlsArray, aPluginXPIUrlsArray.length, this);
xpiManager.initManagerWithHashes(aPluginXPIUrlsArray, aPluginHashes,
aPluginXPIUrlsArray.length, this);
},
// XPI progress listener stuff

View File

@ -342,6 +342,7 @@ nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
// mimetype. So store the pids.
var pluginURLArray = new Array();
var pluginHashArray = new Array();
var pluginPidArray = new Array();
for (pluginInfoItem in this.mPluginInfoArray){
@ -351,12 +352,15 @@ nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
// will complain.
if (pluginItem.toBeInstalled && pluginItem.XPILocation && pluginItem.licenseAccepted) {
pluginURLArray.push(pluginItem.XPILocation);
pluginHashArray.push(pluginItem.XPIHash);
pluginPidArray.push(pluginItem.pid);
}
}
if (pluginURLArray.length > 0)
PluginInstallService.startPluginInsallation(pluginURLArray, pluginPidArray);
PluginInstallService.startPluginInstallation(pluginURLArray,
pluginHashArray,
pluginPidArray);
else
this.advancePage(null, true, false, false);
}
@ -619,6 +623,7 @@ function PluginInfo(aResult) {
this.version = aResult.version;
this.IconUrl = aResult.IconUrl;
this.XPILocation = aResult.XPILocation;
this.XPIHash = aResult.XPIHash;
this.InstallerShowsUI = aResult.InstallerShowsUI;
this.manualInstallationURL = aResult.manualInstallationURL;
this.requestedMimetype = aResult.requestedMimetype;