Bug 392812: Restart button remains disabled after extension updates. r=robstrong

This commit is contained in:
dtownsend@oxymoronical.com 2007-08-31 04:36:42 -07:00
parent fb2ae74a77
commit 852a8f1c86
2 changed files with 5 additions and 10 deletions

View File

@ -817,6 +817,7 @@ XPInstallDownloadManager.prototype = {
} }
gExtensionManager.addDownloads(items, items.length, false); gExtensionManager.addDownloads(items, items.length, false);
updateOptionalViews();
updateGlobalCommands(); updateGlobalCommands();
}, },
@ -833,15 +834,8 @@ XPInstallDownloadManager.prototype = {
onStateChange: function (aAddon, aState, aValue) onStateChange: function (aAddon, aState, aValue)
{ {
const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog; const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog;
var element = this.getElementForAddon(aAddon);
if (!element && aState != nsIXPIProgressDialog.DIALOG_CLOSE)
return;
switch (aState) { switch (aState) {
case nsIXPIProgressDialog.DOWNLOAD_START: case nsIXPIProgressDialog.DOWNLOAD_START:
gInstallCount++;
if (gInstallCount == 1)
updateGlobalCommands();
break;
case nsIXPIProgressDialog.DOWNLOAD_DONE: case nsIXPIProgressDialog.DOWNLOAD_DONE:
case nsIXPIProgressDialog.INSTALL_START: case nsIXPIProgressDialog.INSTALL_START:
break; break;
@ -1455,6 +1449,7 @@ function updateOptionalViews() {
var showLocales = false; var showLocales = false;
var showUpdates = false; var showUpdates = false;
var showInstalls = false; var showInstalls = false;
gInstallCount = 0;
while (elements.hasMoreElements()) { while (elements.hasMoreElements()) {
var e = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource); var e = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
if (!showLocales) { if (!showLocales) {
@ -1570,6 +1565,7 @@ function installUpdatesAll() {
showView("installs"); showView("installs");
// Remove the updates view if there are no add-ons left to update // Remove the updates view if there are no add-ons left to update
updateOptionalViews(); updateOptionalViews();
updateGlobalCommands();
} }
} }
@ -1845,9 +1841,9 @@ var gExtensionsViewController = {
showView("installs"); showView("installs");
var item = gExtensionManager.getItemForID(getIDFromResourceURI(aSelectedItem.id)); var item = gExtensionManager.getItemForID(getIDFromResourceURI(aSelectedItem.id));
gExtensionManager.addDownloads([item], 1, true); gExtensionManager.addDownloads([item], 1, true);
updateGlobalCommands();
// Remove the updates view if there are no add-ons left to update // Remove the updates view if there are no add-ons left to update
updateOptionalViews(); updateOptionalViews();
updateGlobalCommands();
}, },
cmd_includeUpdate: function (aSelectedItem) cmd_includeUpdate: function (aSelectedItem)

View File

@ -5384,7 +5384,6 @@ ExtensionManager.prototype = {
var txnID = Math.round(Math.random() * 100); var txnID = Math.round(Math.random() * 100);
txn.addDownload(currItem, txnID); txn.addDownload(currItem, txnID);
this._transactions.push(txn);
urls.push(currItem.xpiURL); urls.push(currItem.xpiURL);
hashes.push(currItem.xpiHash ? currItem.xpiHash : null); hashes.push(currItem.xpiHash ? currItem.xpiHash : null);
// if this is an update remove the update metadata to prevent it from // if this is an update remove the update metadata to prevent it from
@ -5400,6 +5399,7 @@ ExtensionManager.prototype = {
var id = fromChrome ? PREFIX_ITEM_URI + currItem.id : currItem.xpiURL; var id = fromChrome ? PREFIX_ITEM_URI + currItem.id : currItem.xpiURL;
ds.updateDownloadState(id, "waiting"); ds.updateDownloadState(id, "waiting");
} }
this._transactions.push(txn);
if (fromChrome) { if (fromChrome) {
// Initiate an install from chrome // Initiate an install from chrome
@ -5485,7 +5485,6 @@ ExtensionManager.prototype = {
for (var i = 0; i < this._transactions.length; ++i) { for (var i = 0; i < this._transactions.length; ++i) {
if (this._transactions[i].id == transaction.id) { if (this._transactions[i].id == transaction.id) {
this._transactions.splice(i, 1); this._transactions.splice(i, 1);
delete transaction;
// Remove the observers when all transactions have completed. // Remove the observers when all transactions have completed.
if (this._transactions.length == 0) { if (this._transactions.length == 0) {
gOS.removeObserver(this, "offline-requested"); gOS.removeObserver(this, "offline-requested");