Bug 384925 - Allow PFS to return hashes for plugin XPIs, r=doron
This commit is contained in:
@@ -109,27 +109,31 @@ nsRDFItemUpdater.prototype = {
|
|||||||
target = child;
|
target = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPFSValueFromRDF(aValue, aDatasource, aRDFService){
|
var rdfs = this._rdfService;
|
||||||
|
|
||||||
|
function getPFSValueFromRDF(aValue){
|
||||||
var rv = null;
|
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)
|
if (myTarget)
|
||||||
rv = myTarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
rv = myTarget.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginInfo = new Object();
|
pluginInfo = {
|
||||||
pluginInfo.name = getPFSValueFromRDF("name", aDatasource, this._rdfService);
|
name: getPFSValueFromRDF("name"),
|
||||||
pluginInfo.pid = getPFSValueFromRDF("guid", aDatasource, this._rdfService);
|
pid: getPFSValueFromRDF("guid"),
|
||||||
pluginInfo.version = getPFSValueFromRDF("version", aDatasource, this._rdfService);
|
version: getPFSValueFromRDF("version"),
|
||||||
pluginInfo.IconUrl = getPFSValueFromRDF("IconUrl", aDatasource, this._rdfService);
|
IconUrl: getPFSValueFromRDF("IconUrl"),
|
||||||
pluginInfo.XPILocation = getPFSValueFromRDF("XPILocation", aDatasource, this._rdfService);
|
XPILocation: getPFSValueFromRDF("XPILocation"),
|
||||||
pluginInfo.InstallerShowsUI = getPFSValueFromRDF("InstallerShowsUI", aDatasource, this._rdfService);
|
XPIHash: getPFSValueFromRDF("XPIHash"),
|
||||||
pluginInfo.manualInstallationURL = getPFSValueFromRDF("manualInstallationURL", aDatasource, this._rdfService);
|
InstallerShowsUI: getPFSValueFromRDF("InstallerShowsUI"),
|
||||||
pluginInfo.requestedMimetype = getPFSValueFromRDF("requestedMimetype", aDatasource, this._rdfService);
|
manualInstallationURL: getPFSValueFromRDF("manualInstallationURL"),
|
||||||
pluginInfo.licenseURL = getPFSValueFromRDF("licenseURL", aDatasource, this._rdfService);
|
requestedMimetype: getPFSValueFromRDF("requestedMimetype"),
|
||||||
pluginInfo.needsRestart = getPFSValueFromRDF("needsRestart", aDatasource, this._rdfService);
|
licenseURL: getPFSValueFromRDF("licenseURL"),
|
||||||
|
needsRestart: getPFSValueFromRDF("needsRestart")
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (ex){}
|
catch (ex){}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,15 @@ var PluginInstallService = {
|
|||||||
|
|
||||||
pluginPidArray: null,
|
pluginPidArray: null,
|
||||||
|
|
||||||
startPluginInsallation: function (aPluginXPIUrlsArray, aPluginPidArray) {
|
startPluginInstallation: function (aPluginXPIUrlsArray,
|
||||||
|
aPluginHashes,
|
||||||
|
aPluginPidArray) {
|
||||||
this.pluginPidArray = aPluginPidArray;
|
this.pluginPidArray = aPluginPidArray;
|
||||||
|
|
||||||
var xpiManager = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
|
var xpiManager = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
|
||||||
.createInstance(Components.interfaces.nsIXPInstallManager);
|
.createInstance(Components.interfaces.nsIXPInstallManager);
|
||||||
xpiManager.initManagerFromChrome(aPluginXPIUrlsArray, aPluginXPIUrlsArray.length, this);
|
xpiManager.initManagerWithHashes(aPluginXPIUrlsArray, aPluginHashes,
|
||||||
|
aPluginXPIUrlsArray.length, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// XPI progress listener stuff
|
// XPI progress listener stuff
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
|
|||||||
// mimetype. So store the pids.
|
// mimetype. So store the pids.
|
||||||
|
|
||||||
var pluginURLArray = new Array();
|
var pluginURLArray = new Array();
|
||||||
|
var pluginHashArray = new Array();
|
||||||
var pluginPidArray = new Array();
|
var pluginPidArray = new Array();
|
||||||
|
|
||||||
for (pluginInfoItem in this.mPluginInfoArray){
|
for (pluginInfoItem in this.mPluginInfoArray){
|
||||||
@@ -351,12 +352,15 @@ nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
|
|||||||
// will complain.
|
// will complain.
|
||||||
if (pluginItem.toBeInstalled && pluginItem.XPILocation && pluginItem.licenseAccepted) {
|
if (pluginItem.toBeInstalled && pluginItem.XPILocation && pluginItem.licenseAccepted) {
|
||||||
pluginURLArray.push(pluginItem.XPILocation);
|
pluginURLArray.push(pluginItem.XPILocation);
|
||||||
|
pluginHashArray.push(pluginItem.XPIHash);
|
||||||
pluginPidArray.push(pluginItem.pid);
|
pluginPidArray.push(pluginItem.pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginURLArray.length > 0)
|
if (pluginURLArray.length > 0)
|
||||||
PluginInstallService.startPluginInsallation(pluginURLArray, pluginPidArray);
|
PluginInstallService.startPluginInstallation(pluginURLArray,
|
||||||
|
pluginHashArray,
|
||||||
|
pluginPidArray);
|
||||||
else
|
else
|
||||||
this.advancePage(null, true, false, false);
|
this.advancePage(null, true, false, false);
|
||||||
}
|
}
|
||||||
@@ -619,6 +623,7 @@ function PluginInfo(aResult) {
|
|||||||
this.version = aResult.version;
|
this.version = aResult.version;
|
||||||
this.IconUrl = aResult.IconUrl;
|
this.IconUrl = aResult.IconUrl;
|
||||||
this.XPILocation = aResult.XPILocation;
|
this.XPILocation = aResult.XPILocation;
|
||||||
|
this.XPIHash = aResult.XPIHash;
|
||||||
this.InstallerShowsUI = aResult.InstallerShowsUI;
|
this.InstallerShowsUI = aResult.InstallerShowsUI;
|
||||||
this.manualInstallationURL = aResult.manualInstallationURL;
|
this.manualInstallationURL = aResult.manualInstallationURL;
|
||||||
this.requestedMimetype = aResult.requestedMimetype;
|
this.requestedMimetype = aResult.requestedMimetype;
|
||||||
|
|||||||
Reference in New Issue
Block a user