Bug 854299 - Part 5. Make nsHelperAppDlg.promptForSaveToFileAsync actually async. r=bz

This commit is contained in:
Felipe Gomes 2013-04-01 03:16:13 -03:00
parent 27cdff0dfc
commit 94fd7555bf

View File

@ -279,14 +279,9 @@ nsUnknownContentTypeDialog.prototype = {
.getService(Components.interfaces.nsIDownloadManager);
picker.displayDirectory = dnldMgr.userDownloadsDirectory;
// The last directory preference may not exist, which will throw.
try {
var lastDir = gDownloadLastDir.getFile(aLauncher.source);
if (isUsableDirectory(lastDir))
gDownloadLastDir.getFileAsync(aLauncher.source, function LastDirCallback(lastDir) {
if (lastDir && isUsableDirectory(lastDir))
picker.displayDirectory = lastDir;
}
catch (ex) {
}
if (picker.show() == nsIFilePicker.returnCancel) {
// null result means user cancelled.
@ -316,7 +311,7 @@ nsUnknownContentTypeDialog.prototype = {
result = this.validateLeafName(newDir, result.leafName, null);
}
aLauncher.saveDestinationAvailable(result);
return;
}.bind(this));
},
/**