Bug 283276 - Plugin finder service freezes when attempting to install plugins and not accepting first license. r=mkaply

This commit is contained in:
doronr%us.ibm.com 2005-02-25 16:18:11 +00:00
Родитель 003772fd36
Коммит d9dd4ddf58
1 изменённых файлов: 54 добавлений и 16 удалений

Просмотреть файл

@ -64,7 +64,9 @@ function nsPluginInstallerWizard(){
if ("arguments" in window) {
for (var item in window.arguments[0].plugins){
this.mPluginRequestArray[window.arguments[0].plugins[item].mimetype] = new nsPluginRequest(window.arguments[0].plugins[item]);
this.mPluginRequestArray[window.arguments[0].plugins[item].mimetype] =
new nsPluginRequest(window.arguments[0].plugins[item]);
this.mPluginRequestArrayLength++;
}
@ -202,7 +204,14 @@ nsPluginInstallerWizard.prototype.showLicenses = function (){
this.advancePage(null, false, false, false);
} else {
this.licenseAcceptCounter = 0;
document.getElementById("licenseIFrame").contentWindow.addEventListener("load", gPluginInstaller.enableNext, false);
// add a nsIWebProgress listener to the license iframe.
var docShell = document.getElementById("licenseIFrame").docShell;
var iiReq = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
var webProgress = iiReq.getInterface(Components.interfaces.nsIWebProgress);
webProgress.addProgressListener(gPluginInstaller.progressListener,
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.showLicense();
}
}
@ -213,11 +222,40 @@ nsPluginInstallerWizard.prototype.enableNext = function (){
document.getElementById("licenseRadioGroup2").disabled = false;
}
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
nsPluginInstallerWizard.prototype.progressListener = {
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
if ((aStateFlags & nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK)) {
// iframe loaded
gPluginInstaller.enableNext();
}
},
onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress,
aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
{},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{},
QueryInterface : function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
}
}
nsPluginInstallerWizard.prototype.showLicense = function (){
var pluginInfo = this.mPluginInfoArray[this.mPluginLicenseArray[this.licenseAcceptCounter]];
this.canAdvance(false);
document.getElementById("licenseIFrame").setAttribute("src", pluginInfo.licenseURL);
loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
document.getElementById("licenseIFrame").webNavigation.loadURI(pluginInfo.licenseURL, loadFlags, null, null, null);
document.getElementById("pluginLicenseLabel").firstChild.nodeValue =
this.getFormattedString("pluginLicenseAgreement.label", [pluginInfo.name]);
@ -308,7 +346,7 @@ nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
3 finished installation
4 all done
*/
nsPluginInstallerWizard.prototype.pluginInstallationProgress = function (aPid, aProgress, aError){
nsPluginInstallerWizard.prototype.pluginInstallationProgress = function (aPid, aProgress, aError) {
var statMsg = null;
var pluginInfo = gPluginInstaller.mPluginInfoArray[aPid];