const nsILocalFile = Components.interfaces.nsILocalFile; var customDirPref = document.getElementById("browser.download.dir"); if (customDirPref.value) fp.displayDirectory = customDirPref.value; fp.appendFilters(nsIFilePicker.filterAll); 
var folderListPref = document.getElementById("browser.download.folderList"); var currentDirPref = this._indexToFolder(folderListPref.value); var defDownloads = this._indexToFolder(1);   if (currentDirPref && currentDirPref.exists()) { fp.displayDirectory = currentDirPref; } else if (defDownloads && defDownloads.exists()) { fp.displayDirectory = defDownloads; } else { fp.displayDirectory = this._indexToFolder(0); }  
  chooseFolder: function ()  {    const nsIFilePicker = Components.interfaces.nsIFilePicker;    var fp = Components.classes["@mozilla.org/filepicker;1"]                       .createInstance(nsIFilePicker);    var bundlePreferences = document.getElementById("bundlePreferences");    var title = bundlePreferences.getString("chooseDownloadFolderTitle");    fp.init(window, title, nsIFilePicker.modeGetFolder);    const nsILocalFile = Components.interfaces.nsILocalFile;    var customDirPref = document.getElementById("browser.download.dir");    if (customDirPref.value)      fp.displayDirectory = customDirPref.value;    fp.appendFilters(nsIFilePicker.filterAll);    if (fp.show() == nsIFilePicker.returnOK) {      var file = fp.file.QueryInterface(nsILocalFile);      var currentDirPref = document.getElementById("browser.download.downloadDir");      customDirPref.value = currentDirPref.value = file;      var folderListPref = document.getElementById("browser.download.folderList");      folderListPref.value = this._folderToIndex(file);    }  },
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/30d7fb302b33509f0f45e76ebb30d74f3301cc5f/main.js/buggy/browser/components/preferences/main.js