rem: var startDir = prefs.getComplexValue("browser.download.dir", Components.interfaces.nsILocalFile); if ( startDir.exists() ) { picker.displayDirectory = startDir; } } catch( exception ) { } 
add: if (dir.exists()) picker.displayDirectory = dir; } catch (e) { } 
context:     promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension) {        var result = "";        // Use file picker to show dialog.        var nsIFilePicker = Components.interfaces.nsIFilePicker;        var picker = Components.classes[ "@mozilla.org/filepicker;1" ]                       .createInstance( nsIFilePicker );        var bundle = Components.classes[ "@mozilla.org/intl/stringbundle;1" ]                       .getService( Components.interfaces.nsIStringBundleService )                           .createBundle( "chrome://global/locale/nsHelperAppDlg.properties");        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 );        // Pull in the user's preferences and get the default download directory.        var prefs = Components.classes[ "@mozilla.org/preferences-service;1" ]                              .getService( Components.interfaces.nsIPrefBranch );        try {            var startDir = prefs.getComplexValue("browser.download.dir",                                                 Components.interfaces.nsILocalFile);            if ( startDir.exists() ) {                picker.displayDirectory = startDir;            }        } catch( exception ) {        }        var dlgResult = picker.show();        if ( dlgResult == nsIFilePicker.returnCancel ) {            // Null result means user cancelled.            return null;        }        // be sure to save the directory the user chose as the new browser.download.dir        result = picker.file;        if ( result ) {            var newDir = result.parent;            prefs.setComplexValue("browser.download.dir",                                  Components.interfaces.nsILocalFile, newDir);        }        return result;    },
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/fa2b47f85c60730e0002343d2d367a6b4e3ef764/nsHelperAppDlg.js/buggy/embedding/components/ui/helperAppDlg/nsHelperAppDlg.js