170006 - more downloading stuff for EM

This commit is contained in:
ben%bengoodger.com 2004-05-12 05:04:14 +00:00
Родитель 50d28a7e7a
Коммит e71553712c
2 изменённых файлов: 8 добавлений и 8 удалений

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

@ -246,20 +246,16 @@ XPInstallDownloadManager.prototype = {
var element = document.getElementById(aURL); var element = document.getElementById(aURL);
switch (aState) { switch (aState) {
case nsIXPIProgressDialog.DOWNLOAD_START: case nsIXPIProgressDialog.DOWNLOAD_START:
dump("*** download start\n");
element.setAttribute("state", "waiting"); element.setAttribute("state", "waiting");
element.setAttribute("progress", "0"); element.setAttribute("progress", "0");
break; break;
case nsIXPIProgressDialog.DOWNLOAD_DONE: case nsIXPIProgressDialog.DOWNLOAD_DONE:
dump("*** download done\n");
element.setAttribute("progress", "100"); element.setAttribute("progress", "100");
break; break;
case nsIXPIProgressDialog.INSTALL_START: case nsIXPIProgressDialog.INSTALL_START:
dump("*** install start\n");
element.setAttribute("state", "installing"); element.setAttribute("state", "installing");
break; break;
case nsIXPIProgressDialog.INSTALL_DONE: case nsIXPIProgressDialog.INSTALL_DONE:
dump("*** install done\n");
element.setAttribute("state", "done"); element.setAttribute("state", "done");
var msg; var msg;
if (aValue != 0) { if (aValue != 0) {

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

@ -1614,7 +1614,8 @@ nsExtensionManager.prototype = {
var txn = new nsItemDownloadTransaction(this); var txn = new nsItemDownloadTransaction(this);
for (var i = 0; i < aItemCount; ++i) { for (var i = 0; i < aItemCount; ++i) {
var currItem = aItems[i]; var currItem = aItems[i];
txn.addDownload(currItem.name, currItem.updateURL, currItem.iconURL, currItem.type); txn.addDownload(currItem.name, currItem.updateURL, currItem.iconURL,
currItem.type, this._transactions.length);
this._transactions.push(txn); this._transactions.push(txn);
} }
@ -1653,7 +1654,7 @@ nsExtensionManager.prototype = {
const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog; const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog;
if (aState == nsIXPIProgressDialog.DIALOG_CLOSE) { if (aState == nsIXPIProgressDialog.DIALOG_CLOSE) {
for (var i = 0; i < this._transactions.length; ++i) { for (var i = 0; i < this._transactions.length; ++i) {
if (this._transactions[i] == aTransaction) { if (this._transactions[i].id == aTransaction.id) {
this._transactions.splice(i, 1); this._transactions.splice(i, 1);
delete aTransaction; delete aTransaction;
break; break;
@ -1782,16 +1783,19 @@ nsExtensionManager.prototype = {
function nsItemDownloadTransaction(aManager) function nsItemDownloadTransaction(aManager)
{ {
this._manager = aManager; this._manager = aManager;
this._downloads = [];
} }
nsItemDownloadTransaction.prototype = { nsItemDownloadTransaction.prototype = {
_manager : null, _manager : null,
_downloads : [], _downloads : [],
id : -1,
addDownload: function (aName, aURL, aIconURL, aItemType) addDownload: function (aName, aURL, aIconURL, aItemType, aID)
{ {
this._downloads.push({ url: aURL, type: aItemType, waiting: true }); this._downloads.push({ url: aURL, type: aItemType, waiting: true });
this._manager._ds.addDownload(aName, aURL, aIconURL, aItemType); this._manager._ds.addDownload(aName, aURL, aIconURL, aItemType);
this.id = aID;
}, },
removeDownload: function (aURL, aItemType) removeDownload: function (aURL, aItemType)
@ -2462,7 +2466,7 @@ nsExtensionsDataSource.prototype = {
var ctr = Components.classes["@mozilla.org/rdf/container;1"] var ctr = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer); .createInstance(Components.interfaces.nsIRDFContainer);
ctr.Init(this._profileExtensions, root); ctr.Init(this._profileExtensions, root);
if (ctr.IndexOf(res) == -1) if (ctr.IndexOf(res) == -1)
ctr.InsertElementAt(res, 1, true); ctr.InsertElementAt(res, 1, true);
this._flush(true); this._flush(true);