Bug 395708: handle invalid IDs passed to nsIDownloadManagerUI::show (makes clicking on the "download complete" notification work when the download manager isn't open), r=sdwilsh

This commit is contained in:
gavin@gavinsharp.com 2007-09-17 11:43:32 -07:00
parent c1b55b8a66
commit 9d7c6a0d55
2 changed files with 9 additions and 2 deletions

View File

@ -72,12 +72,18 @@ nsDownloadManagerUI.prototype = {
window = aWindowContext.getInterface(Ci.nsIDOMWindow);
} catch (e) { /* it's OK to not have a parent window */ }
// We pass the download manager and the nsIDownload we want selected
// We pass the download manager and the nsIDownload we want selected (if any)
var params = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
var dm = Cc["@mozilla.org/download-manager;1"].
getService(Ci.nsIDownloadManager);
params.appendElement(dm, false);
params.appendElement(dm.getDownload(aID), false);
// Don't fail if our passed in ID is invalid
var download = null;
try {
download = dm.getDownload(aID);
} catch (ex) {}
params.appendElement(download, false);
var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);

View File

@ -126,6 +126,7 @@ nsDownloadScanner::FindCLSID()
}
ULONG nReceived;
clsidEnumerator->Next(1, &mScannerCLSID, &nReceived);
clsidEnumerator->Next(1, &mScannerCLSID, &nReceived);
if (nReceived == 0) {
// No installed Anti Virus program
return -3;