Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox addon InstallTrigger.install在使用-chrome时无法在Firefox 4中运行。有什么解决办法吗?_Firefox Addon_Xul - Fatal编程技术网

Firefox addon InstallTrigger.install在使用-chrome时无法在Firefox 4中运行。有什么解决办法吗?

Firefox addon InstallTrigger.install在使用-chrome时无法在Firefox 4中运行。有什么解决办法吗?,firefox-addon,xul,Firefox Addon,Xul,我在Firefox的chrome模式下运行一个应用程序(fx.exe-chrome)chrome://app/content/main.xul). 在Firefox4(3.6及以下版本)之前,当有新版本可用时,我使用InstallTrigger.install升级应用程序 不幸的是,这在Firefox4中不再有效。还有其他人遇到过这个问题吗?您是如何解决的?为了解决这个问题,我们使用AddOnManager API代替InstallTrigger 有关更多信息,请参阅 Components.ut

我在Firefox的chrome模式下运行一个应用程序(fx.exe-chrome)chrome://app/content/main.xul). 在Firefox4(3.6及以下版本)之前,当有新版本可用时,我使用InstallTrigger.install升级应用程序


不幸的是,这在Firefox4中不再有效。还有其他人遇到过这个问题吗?您是如何解决的?

为了解决这个问题,我们使用AddOnManager API代替InstallTrigger

有关更多信息,请参阅

Components.utils['import']("resource://gre/modules/AddonManager.jsm");

AddonManager.getInstallForURL(xpi_address, function(addon) {
    addon.addListener({
        onDownloadStarted: function() {
            alert('Download Started');
        }
      });
      addon.addListener({
        onDownloadProgress: function() {
            var complete_percent = parseInt((100 * (addon.progress/addon.maxProgress)),10);
        }
      });
      addon.addListener({
        onDownloadFailed: function() {
            alert('Upgrade Failed');
        }
      });
      addon.addListener({
        onDownloadEnded: function() {
            alert('Download Successful');
        }
      });
      addon.addListener({
        onInstallStarted: function() {
            alert('Install Started');
        }
      });
      addon.addListener({
        onInstallEnded: function() {
            alert('Install Successful');
        }
      });
      addon.addListener({
        onInstallFailed: function() {
            alert('Install Failed');
        }
      });
      addon.install();
    }, "application/x-xpinstall");