home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Programy / nsb-install-8-0.exe / chrome / toolkit.jar / content / mozapps / plugins / pluginInstallerWizard.js < prev    next >
Text File  |  2005-07-29  |  21KB  |  586 lines

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3.  *
  4.  * The contents of this file are subject to the Mozilla Public License Version
  5.  * 1.1 (the "License"); you may not use this file except in compliance with
  6.  * the License. You may obtain a copy of the License at
  7.  * http://www.mozilla.org/MPL/
  8.  *
  9.  * Software distributed under the License is distributed on an "AS IS" basis,
  10.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  * for the specific language governing rights and limitations under the
  12.  * License.
  13.  *
  14.  * The Original Code is Plugin Finder Service.
  15.  *
  16.  * The Initial Developer of the Original Code is
  17.  * IBM Corporation.
  18.  * Portions created by the IBM Corporation are Copyright (C) 2004
  19.  * IBM Corporation. All Rights Reserved.
  20.  *
  21.  * Contributor(s):
  22.  *   Doron Rosenberg <doronr@us.ibm.com>
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. function nsPluginInstallerWizard(){
  39.  
  40.   // create the request array
  41.   this.mPluginRequestArray = new Object();
  42.   // since the array is a hash, store the length
  43.   this.mPluginRequestArrayLength = 0;
  44.  
  45.   // create the plugin info array.
  46.   // a hash indexed by plugin id so we don't install 
  47.   // the same plugin more than once.
  48.   this.mPluginInfoArray = new Object();
  49.   this.mPluginInfoArrayLength = 0;
  50.  
  51.   // holds plugins we couldn't find
  52.   this.mPluginNotFoundArray = new Object();
  53.   this.mPluginNotFoundArrayLength = 0;
  54.  
  55.   // array holding pids of plugins that require a license
  56.   this.mPluginLicenseArray = new Array();
  57.  
  58.   this.mTab = null;
  59.   this.mSuccessfullPluginInstallation = 0;
  60.  
  61.   // arguments[0] is an array that contains two items:
  62.   //     an array of mimetypes that are missing
  63.   //     a reference to the tab that needs them, so we can reload it
  64.  
  65.   if ("arguments" in window) {
  66.     for (var item in window.arguments[0].plugins){
  67.       this.mPluginRequestArray[window.arguments[0].plugins[item].mimetype] = new nsPluginRequest(window.arguments[0].plugins[item]);
  68.       this.mPluginRequestArrayLength++;
  69.     }
  70.  
  71.     this.mTab = window.arguments[0].tab;
  72.   }
  73.  
  74.   this.WSPluginCounter = 0;
  75.   this.licenseAcceptCounter = 0;
  76.   
  77.   this.prefBranch = null;
  78. }
  79.  
  80. nsPluginInstallerWizard.prototype.getPluginData = function (){
  81.   // for each mPluginRequestArray item, call the datasource
  82.   this.WSPluginCounter = 0;
  83.  
  84.   // initiate the datasource call
  85.   var rdfUpdater = new nsRDFItemUpdater(this.getOS(), this.getChromeLocale());
  86.  
  87.   for (item in this.mPluginRequestArray) {
  88.     rdfUpdater.checkForPlugin(this.mPluginRequestArray[item]);
  89.   }
  90. }
  91.  
  92. // aPluginInfo is null if the datasource call failed, and pid is -1 if
  93. // no matching plugin was found.
  94. nsPluginInstallerWizard.prototype.pluginInfoReceived = function (aPluginInfo){
  95.   this.WSPluginCounter++;
  96.  
  97.   if (aPluginInfo && (aPluginInfo.pid != -1) ) {
  98.     // hash by id
  99.     this.mPluginInfoArray[aPluginInfo.pid] = new PluginInfo(aPluginInfo);
  100.     this.mPluginInfoArrayLength++;
  101.   } else {
  102.     this.mPluginNotFoundArray[aPluginInfo.requestedMimetype] = new PluginInfo(aPluginInfo);
  103.     this.mPluginNotFoundArrayLength++;
  104.   }
  105.  
  106.   var progressMeter = document.getElementById("ws_request_progress");
  107.  
  108.   if (progressMeter.getAttribute("mode") == "undetermined")
  109.     progressMeter.setAttribute("mode", "determined");
  110.  
  111.   progressMeter.setAttribute("value", 
  112.       ((this.WSPluginCounter / this.mPluginRequestArrayLength) * 100) + "%");
  113.  
  114.   if (this.WSPluginCounter == this.mPluginRequestArrayLength) {
  115.     // check if no plugins were found
  116.     if (this.mPluginInfoArrayLength == 0) {
  117.       this.advancePage("lastpage", true, false, false);
  118.     } else {
  119.       this.advancePage(null, true, false, true);
  120.     }  
  121.   } else {
  122.     // process more.
  123.   }
  124.  
  125. nsPluginInstallerWizard.prototype.showPluginList = function (){
  126.   var myPluginList = document.getElementById("pluginList");
  127.   var hasPluginWithInstallerUI = false;
  128.  
  129.   // clear children
  130.   for (var run = myPluginList.childNodes.length; run > 0; run--)
  131.     myPluginList.removeChild(myPluginList.childNodes.item(run));
  132.  
  133.   for (pluginInfoItem in this.mPluginInfoArray){
  134.     // [plugin image] [Plugin_Name Plugin_Version]
  135.  
  136.     var pluginInfo = this.mPluginInfoArray[pluginInfoItem];
  137.  
  138.     // create the checkbox
  139.     var myCheckbox = document.createElement("checkbox");
  140.     myCheckbox.setAttribute("checked", "true");
  141.     myCheckbox.setAttribute("oncommand", "gPluginInstaller.toggleInstallPlugin('" + pluginInfo.pid + "', this)");
  142.     // XXXlocalize (nit)
  143.     myCheckbox.setAttribute("label", pluginInfo.name + " " + (pluginInfo.version ? pluginInfo.version : ""));
  144.     myCheckbox.setAttribute("src", pluginInfo.IconUrl);
  145.  
  146.     myPluginList.appendChild(myCheckbox);
  147.     
  148.     if (pluginInfo.InstallerShowsUI == "true")
  149.       hasPluginWithInstallerUI = true;
  150.   }
  151.  
  152.   if (hasPluginWithInstallerUI)
  153.     document.getElementById("installerUI").hidden = false;
  154.  
  155.   this.canAdvance(true);
  156.   this.canRewind(false);
  157.  
  158. nsPluginInstallerWizard.prototype.toggleInstallPlugin = function (aPid, aCheckbox) {
  159.   this.mPluginInfoArray[aPid].toBeInstalled = aCheckbox.checked;
  160.  
  161.   // if no plugins are checked, don't allow to advance  
  162.   var pluginsToInstallNum = 0;
  163.   for (pluginInfoItem in this.mPluginInfoArray){
  164.     if (this.mPluginInfoArray[pluginInfoItem].toBeInstalled)
  165.       pluginsToInstallNum++;
  166.   }
  167.  
  168.   if (pluginsToInstallNum > 0)
  169.     this.canAdvance(true);
  170.   else
  171.     this.canAdvance(false);
  172. }
  173.  
  174. nsPluginInstallerWizard.prototype.canAdvance = function (aBool){
  175.   document.getElementById("plugin-installer-wizard").canAdvance = aBool;
  176. }
  177.  
  178. nsPluginInstallerWizard.prototype.canRewind = function (aBool){
  179.   document.getElementById("plugin-installer-wizard").canRewind = aBool;
  180. }
  181.  
  182. nsPluginInstallerWizard.prototype.canCancel = function (aBool){
  183.   document.documentElement.getButton("cancel").disabled = !aBool;
  184. }
  185.  
  186. nsPluginInstallerWizard.prototype.showLicenses = function (){
  187.   this.canAdvance(true);
  188.   this.canRewind(false);
  189.  
  190.   // only add if a license is provided and the plugin was selected to
  191.   // be installed
  192.   for (pluginInfoItem in this.mPluginInfoArray){
  193.     var myPluginInfoItem = this.mPluginInfoArray[pluginInfoItem];
  194.     if (myPluginInfoItem.toBeInstalled && myPluginInfoItem.licenseURL && (myPluginInfoItem.licenseURL != ""))
  195.       this.mPluginLicenseArray.push(myPluginInfoItem.pid);
  196.   }
  197.  
  198.   if (this.mPluginLicenseArray.length == 0) {
  199.     // no plugins require licenses  
  200.     this.advancePage(null, true, false, false);
  201.   } else {
  202.     this.licenseAcceptCounter = 0;
  203.     document.getElementById("licenseIFrame").contentWindow.addEventListener("load", gPluginInstaller.enableNext, false);
  204.     this.showLicense();
  205.   }
  206.  
  207. nsPluginInstallerWizard.prototype.enableNext = function (){
  208.   gPluginInstaller.canAdvance(true);
  209.   document.getElementById("licenseRadioGroup1").disabled = false;
  210.   document.getElementById("licenseRadioGroup2").disabled = false;
  211. }
  212.  
  213. nsPluginInstallerWizard.prototype.showLicense = function (){
  214.   var pluginInfo = this.mPluginInfoArray[this.mPluginLicenseArray[this.licenseAcceptCounter]];
  215.  
  216.   this.canAdvance(false);
  217.   document.getElementById("licenseIFrame").setAttribute("src", pluginInfo.licenseURL);
  218.  
  219.   document.getElementById("pluginLicenseLabel").firstChild.nodeValue = 
  220.     this.getFormattedString("pluginLicenseAgreement.label", [pluginInfo.name]);
  221.  
  222.   document.getElementById("licenseRadioGroup1").disabled = true;
  223.   document.getElementById("licenseRadioGroup2").disabled = true;
  224.   document.getElementById("licenseRadioGroup").selectedIndex = 
  225.     pluginInfo.licenseAccepted ? 0 : 1;
  226. }
  227.  
  228. nsPluginInstallerWizard.prototype.showNextLicense = function (){
  229.   var rv = true;
  230.  
  231.   if (this.mPluginLicenseArray.length > 0) {
  232.     this.storeLicenseRadioGroup();
  233.  
  234.     this.licenseAcceptCounter++;
  235.  
  236.     if (this.licenseAcceptCounter < this.mPluginLicenseArray.length) {
  237.       this.showLicense();
  238.  
  239.       rv = false;
  240.       this.canRewind(true);
  241.     }
  242.   }
  243.   
  244.   return rv;
  245. }
  246.  
  247. nsPluginInstallerWizard.prototype.showPreviousLicense = function (){
  248.   this.storeLicenseRadioGroup();
  249.   this.licenseAcceptCounter--;
  250.  
  251.   if (this.licenseAcceptCounter > 0)
  252.     this.canRewind(true);
  253.   else
  254.     this.canRewind(false);
  255.  
  256.   this.showLicense();
  257.   
  258.   // don't allow to return from the license screens
  259.   return false;
  260. }
  261.  
  262. nsPluginInstallerWizard.prototype.storeLicenseRadioGroup = function (){
  263.   var pluginInfo = this.mPluginInfoArray[this.mPluginLicenseArray[this.licenseAcceptCounter]];
  264.   pluginInfo.licenseAccepted = !document.getElementById("licenseRadioGroup").selectedIndex;
  265. }
  266.  
  267. nsPluginInstallerWizard.prototype.advancePage = function (aPageId, aCanAdvance, aCanRewind, aCanCancel){
  268.   this.canAdvance(true);
  269.   document.getElementById("plugin-installer-wizard").advance(aPageId);
  270.  
  271.   this.canAdvance(aCanAdvance);
  272.   this.canRewind(aCanRewind);
  273.   this.canCancel(aCanCancel);
  274.  
  275. nsPluginInstallerWizard.prototype.startPluginInstallation = function (){
  276.   this.canAdvance(false);
  277.   this.canRewind(false);
  278.  
  279.   // since the user can choose what plugins to install, we need to store
  280.   // which ones were choosen, as nsIXPInstallManager returns an index and not the
  281.   // mimetype.  So store the pids.
  282.  
  283.   var pluginURLArray = new Array();
  284.   var pluginPidArray = new Array();
  285.  
  286.   for (pluginInfoItem in this.mPluginInfoArray){
  287.     var pluginItem = this.mPluginInfoArray[pluginInfoItem];
  288.     if (pluginItem.toBeInstalled && pluginItem.licenseAccepted) {
  289.       pluginURLArray.push(pluginItem.XPILocation);
  290.       pluginPidArray.push(pluginItem.pid);
  291.     }  
  292.   }
  293.  
  294.   if (pluginURLArray.length > 0)
  295.     PluginInstallService.startPluginInsallation(pluginURLArray, pluginPidArray);
  296.   else
  297.     this.advancePage(null, true, false, false);
  298. }
  299.  
  300. /*
  301.   0    starting download
  302.   1    download finished
  303.   2    starting installation
  304.   3    finished installation
  305.   4    all done
  306. */
  307. nsPluginInstallerWizard.prototype.pluginInstallationProgress = function (aPid, aProgress, aError){
  308.  
  309.   var statMsg = null;
  310.   var pluginInfo = gPluginInstaller.mPluginInfoArray[aPid];
  311.  
  312.   switch (aProgress) {
  313.   
  314.     case 0:
  315.       statMsg = this.getFormattedString("pluginInstallation.download.start", [pluginInfo.name]);
  316.       break;
  317.  
  318.     case 1:
  319.       statMsg = this.getFormattedString("pluginInstallation.download.finish", [pluginInfo.name]);
  320.       break;
  321.  
  322.     case 2:
  323.       statMsg = this.getFormattedString("pluginInstallation.install.start", [pluginInfo.name]);
  324.       break;  
  325.  
  326.     case 3:
  327.       if (aError) {
  328.         statMsg = this.getFormattedString("pluginInstallation.install.error", [pluginInfo.name, aError]);
  329.         pluginInfo.error = aError;
  330.       } else {
  331.         statMsg = this.getFormattedString("pluginInstallation.install.finish", [pluginInfo.name]);
  332.         pluginInfo.error = null;
  333.       }
  334.       break;
  335.  
  336.     case 4:
  337.       statMsg = this.getString("pluginInstallation.complete");
  338.       break;
  339.   }
  340.  
  341.   if (statMsg)
  342.     document.getElementById("plugin_install_progress_message").value = statMsg;
  343.  
  344.   if (aProgress == 4) {
  345.     this.advancePage(null, true, false, false);
  346.   }
  347. }
  348.  
  349. nsPluginInstallerWizard.prototype.pluginInstallationProgressMeter = function (aPid, aValue, aMaxValue){
  350.   var progressElm = document.getElementById("plugin_install_progress");
  351.  
  352.   if (progressElm.getAttribute("mode") == "undetermined")
  353.     progressElm.setAttribute("mode", "determined");
  354.   
  355.   progressElm.setAttribute("value", Math.ceil((aValue / aMaxValue) * 100) + "%")
  356. }
  357.  
  358. nsPluginInstallerWizard.prototype.addPluginResultRow = function (aImgSrc, aName, aNameTooltip, aStatus, aStatusTooltip, aManualUrl){
  359.   var myRows = document.getElementById("pluginResultList");
  360.  
  361.   var myRow = document.createElement("row");
  362.   myRow.setAttribute("align", "center");
  363.  
  364.   // create the image
  365.   var myImage = document.createElement("image");
  366.   myImage.setAttribute("src", aImgSrc);
  367.   myImage.setAttribute("height", "16px");
  368.   myImage.setAttribute("width", "16px");
  369.   myRow.appendChild(myImage)
  370.  
  371.   // create the labels
  372.   var myLabel = document.createElement("label");
  373.   myLabel.setAttribute("value", aName);
  374.   if (aNameTooltip)
  375.     myLabel.setAttribute("tooltiptext", aNameTooltip);
  376.   myRow.appendChild(myLabel);
  377.  
  378.   if (aStatus) {
  379.     myLabel = document.createElement("label");
  380.     myLabel.setAttribute("value", aStatus);
  381.     myRow.appendChild(myLabel);
  382.   }
  383.  
  384.   // manual install
  385.   if (aManualUrl) {
  386.     var myButton = document.createElement("button");
  387.  
  388.     var manualInstallLabel = this.getString("pluginInstallationSummary.manualInstall.label");
  389.     var manualInstallTooltip = this.getString("pluginInstallationSummary.manualInstall.tooltip");
  390.  
  391.     myButton.setAttribute("label", manualInstallLabel);
  392.     myButton.setAttribute("tooltiptext", manualInstallTooltip);
  393.  
  394.     myRow.appendChild(myButton);
  395.   }
  396.  
  397.   myRows.appendChild(myRow);
  398.  
  399.   // XXX: need to add the listener after it got added into the document
  400.   if (aManualUrl)
  401.     myButton.addEventListener("command", function() { gPluginInstaller.loadURL(aManualUrl) }, false);
  402. }
  403.  
  404. nsPluginInstallerWizard.prototype.showPluginResults = function (){
  405.   var notInstalledList = "?action=missingplugins";
  406.   var needsRestart = false;
  407.   var myRows = document.getElementById("pluginResultList");
  408.  
  409.   // clear children
  410.   for (var run = myRows.childNodes.length; run--; run > 0)
  411.     myRows.removeChild(myRows.childNodes.item(run));
  412.  
  413.   for (pluginInfoItem in this.mPluginInfoArray){
  414.     // [plugin image] [Plugin_Name Plugin_Version] [Success/Failed] [Manual Install (if Failed)]
  415.  
  416.     var myPluginItem = this.mPluginInfoArray[pluginInfoItem];
  417.     
  418.     if (myPluginItem.needsRestart)
  419.       needsRestart = true;
  420.  
  421.     if (myPluginItem.toBeInstalled) {
  422.       var statusMsg;
  423.       var statusTooltip;
  424.       if (myPluginItem.error){
  425.         statusMsg = this.getString("pluginInstallationSummary.failed");
  426.         statusTooltip = myPluginItem.error;
  427.         notInstalledList += "&mimetype=" + pluginInfoItem;
  428.       } else if (!myPluginItem.licenseAccepted) {
  429.         statusMsg = this.getString("pluginInstallationSummary.licenseNotAccepted");
  430.       } else if (!myPluginItem.XPILocation) {
  431.         statusMsg = this.getString("pluginInstallationSummary.notAvailable");
  432.         notInstalledList += "&mimetype=" + pluginInfoItem;
  433.       } else {
  434.         this.mSuccessfullPluginInstallation++;
  435.         statusMsg = this.getString("pluginInstallationSummary.success");
  436.       }
  437.  
  438.       // manual url - either returned from the webservice or the pluginspage attribute
  439.       var manualUrl;
  440.       if ((myPluginItem.error || !myPluginItem.XPILocation) && (myPluginItem.manualInstallationURL || this.mPluginRequestArray[myPluginItem.requestedMimetype].pluginsPage)){
  441.         manualUrl = myPluginItem.manualInstallationURL ? myPluginItem.manualInstallationURL : this.mPluginRequestArray[myPluginItem.requestedMimetype].pluginsPage;
  442.       }  
  443.  
  444.       this.addPluginResultRow(
  445.           myPluginItem.IconUrl, 
  446.           myPluginItem.name + " " + (myPluginItem.version ? myPluginItem.version : ""),
  447.           null,
  448.           statusMsg, 
  449.           statusTooltip, 
  450.           manualUrl);
  451.     }
  452.   }
  453.  
  454.   // handle plugins we couldn't find
  455.   for (pluginInfoItem in this.mPluginNotFoundArray){
  456.     var pluginRequest = this.mPluginRequestArray[pluginInfoItem];
  457.  
  458.     // if there is a pluginspage, show UI
  459.     if (pluginRequest && pluginRequest.pluginsPage) {
  460.       this.addPluginResultRow(
  461.           "",
  462.           this.getString("pluginInstallation.unknownPlugin"),
  463.           pluginInfoItem,
  464.           null,
  465.           null,
  466.           this.mPluginRequestArray[pluginInfoItem].pluginsPage);
  467.     }
  468.  
  469.     notInstalledList += "&mimetype=" + pluginInfoItem;
  470.   }
  471.  
  472.   // no plugins were found, so change the description of the final page.
  473.   if (this.mPluginInfoArrayLength == 0) {
  474.     var noPluginsFound = this.getString("pluginInstallation.noPluginsFound");
  475.     document.getElementById("pluginSummaryDescription").setAttribute("value", noPluginsFound);
  476.   }
  477.  
  478.   document.getElementById("pluginSummaryRestartNeeded").hidden = !needsRestart;
  479.  
  480.   // set the get more info link to contain the mimetypes we couldn't install.
  481.   notInstalledList +=
  482.     "&appID=" + this.getPrefBranch().getCharPref("app.id") +
  483.     "&appVersion=" + this.getPrefBranch().getCharPref("app.build_id") +
  484.     "&clientOS=" + this.getOS() +
  485.     "&chromeLocale=" + this.getChromeLocale();
  486.  
  487.   document.getElementById("moreInfoLink").addEventListener("click", function() { gPluginInstaller.loadURL("https://pfs.mozilla.org/plugins/" + notInstalledList) }, false);
  488.  
  489.   // clear the tab's plugin list
  490.   this.mTab.missingPlugins = null;
  491.  
  492.   this.canAdvance(true);
  493.   this.canRewind(false);
  494.   this.canCancel(false);
  495.  
  496. nsPluginInstallerWizard.prototype.loadURL = function (aUrl){
  497.   // Check if the page where the plugin came from can load aUrl before
  498.   // loading it, and do *not* allow loading javascript: or data: URIs.
  499.   var pluginPage = window.opener.content.location.href;
  500.  
  501.   const nsIScriptSecurityManager =
  502.     Components.interfaces.nsIScriptSecurityManager;
  503.   var secMan =
  504.     Components.classes["@mozilla.org/scriptsecuritymanager;1"]
  505.     .getService(nsIScriptSecurityManager);
  506.  
  507.   secMan.checkLoadURIStr(pluginPage, aUrl,
  508.                          nsIScriptSecurityManager.DISALLOW_SCRIPT_OR_DATA);
  509.  
  510.   window.opener.open(aUrl);
  511. }
  512.  
  513. nsPluginInstallerWizard.prototype.getString = function (aName){
  514.   return document.getElementById("pluginWizardString").getString(aName);
  515. }
  516.  
  517. nsPluginInstallerWizard.prototype.getFormattedString = function (aName, aArray){
  518.   return document.getElementById("pluginWizardString").getFormattedString(aName, aArray);
  519. }
  520.  
  521. nsPluginInstallerWizard.prototype.getOS = function (){
  522.   var httpService = Components.classes["@mozilla.org/network/protocol;1?name=http"]
  523.                               .getService(Components.interfaces.nsIHttpProtocolHandler);
  524.   return httpService.oscpu;
  525. }
  526.  
  527. nsPluginInstallerWizard.prototype.getChromeLocale = function (){
  528.   var chromeReg = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
  529.                             .getService(Components.interfaces.nsIXULChromeRegistry);
  530.   return chromeReg.getSelectedLocale("global");
  531. }
  532.  
  533. nsPluginInstallerWizard.prototype.getPrefBranch = function (){
  534.   if (!this.prefBranch)
  535.     this.prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
  536.                                 .getService(Components.interfaces.nsIPrefBranch);
  537.   return this.prefBranch;
  538. }
  539. function nsPluginRequest(aPlugRequest){
  540.   this.mimetype = encodeURI(aPlugRequest.mimetype);
  541.   this.pluginsPage = aPlugRequest.pluginsPage;
  542. }
  543.  
  544. function PluginInfo(aResult) {
  545.   this.name = aResult.name;
  546.   this.pid = aResult.pid;
  547.   this.version = aResult.version;
  548.   this.IconUrl = aResult.IconUrl;
  549.   this.XPILocation = aResult.XPILocation;
  550.   this.InstallerShowsUI = aResult.InstallerShowsUI;
  551.   this.manualInstallationURL = aResult.manualInstallationURL;
  552.   this.requestedMimetype = aResult.requestedMimetype;
  553.   this.licenseURL = aResult.licenseURL;
  554.   this.needsRestart = (aResult.needsRestart == "true");
  555.  
  556.   this.error = null;
  557.   this.toBeInstalled = true;
  558.  
  559.   // no license provided, make it accepted
  560.   this.licenseAccepted = this.licenseURL ? false : true;
  561. }
  562.  
  563. var gPluginInstaller;
  564.  
  565. function wizardInit(){
  566.   gPluginInstaller = new nsPluginInstallerWizard();
  567.   gPluginInstaller.canAdvance(false);
  568.   gPluginInstaller.getPluginData();
  569. }
  570.  
  571. function wizardFinish(){
  572.   // don't refresh if no plugins were found or installed
  573.   if ((gPluginInstaller.mSuccessfullPluginInstallation > 0) && 
  574.       (gPluginInstaller.mPluginInfoArray.length != 0) && 
  575.       gPluginInstaller.mTab) {
  576.     window.opener.getBrowser().reloadTab(gPluginInstaller.mTab);
  577.   }
  578.  
  579.   return true;
  580. }
  581.