rem: if (dir && autoDownload) { 
add: if (autoDownload && dir && dir.exists()) { 
context:     promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension) {        var result = "";        const prefSvcContractID = "@mozilla.org/preferences-service;1";        const prefSvcIID = Components.interfaces.nsIPrefService;        var branch = Components.classes[prefSvcContractID].getService(prefSvcIID)                                                          .getBranch("browser.download.");        var dir = null;        const nsILocalFile = Components.interfaces.nsILocalFile;        const kDownloadDirPref = "dir";        // Try and pull in download directory pref        try {            dir = branch.getComplexValue(kDownloadDirPref, nsILocalFile);        } catch (e) { }        var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]                               .getService(Components.interfaces.nsIStringBundleService)                               .createBundle("chrome://global/locale/nsHelperAppDlg.properties");        var autoDownload = branch.getBoolPref("autoDownload");        // If the autoDownload pref is set then just download to default download directory        if (dir && autoDownload) {            if (aDefaultFile == "")                aDefaultFile = bundle.GetStringFromName("noDefaultFile") + (aSuggestedFileExtension || "");            dir.append(aDefaultFile);            return uniqueFile(dir);        }        // Use file picker to show dialog.        var nsIFilePicker = Components.interfaces.nsIFilePicker;        var picker = Components.classes[ "@mozilla.org/filepicker;1" ]                       .createInstance( nsIFilePicker );        var windowTitle = bundle.GetStringFromName( "saveDialogTitle" );        var parent = aContext                        .QueryInterface( Components.interfaces.nsIInterfaceRequestor )                        .getInterface( Components.interfaces.nsIDOMWindowInternal );        picker.init( parent, windowTitle, nsIFilePicker.modeSave );        picker.defaultString = aDefaultFile;        if (aSuggestedFileExtension) {            // aSuggestedFileExtension includes the period, so strip it            picker.defaultExtension = aSuggestedFileExtension.substring(1);        } else {            try {                picker.defaultExtension = this.mLauncher.MIMEInfo.primaryExtension;            } catch (ex) {            }        }        var wildCardExtension = "*";        if ( aSuggestedFileExtension ) {            wildCardExtension += aSuggestedFileExtension;            picker.appendFilter( wildCardExtension, wildCardExtension );        }        picker.appendFilters( nsIFilePicker.filterAll );        try {            if (dir.exists())                picker.displayDirectory = dir;        } catch (e) { }        if (picker.show() == nsIFilePicker.returnCancel || !picker.file) {            // Null result means user cancelled.            return null;        }        // If not using specified location save the user's choice of directory        if (branch.getBoolPref("lastLocation") || autoDownload) {            var directory = picker.file.parent.QueryInterface(nsILocalFile);            branch.setComplexValue(kDownloadDirPref, nsILocalFile, directory);        }        return picker.file;    },
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/9b7929c07af7099c6a248d969af31a067ff3cbda/nsHelperAppDlg.js/clean/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js