rem: const defaultFolderPref = "browser.download.defaultFolder"; 
add: var defaultFolderPref = "browser.download.defaultFolder"; var downloadDirPref = "browser.download.dir"; 
context: function updateSaveToFolder(){  var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);  function getPref(aPrefName, aPrefGetter, aDefVal)   {    try {      var val = prefs[aPrefGetter](aPrefName);    }    catch (e) {      val = aDefVal;    }    return val;                  }  const defaultFolderPref = "browser.download.defaultFolder";  var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://browser/content/pref/pref-downloads.xul"];  // Don't let the variable names here fool you. This code executes if the   // user chooses to have all files auto-download to a specific folder.  if (data.askOnSave.value == "true") {    var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties);    var targetFolder = null;    switch (parseInt(data.downloadFolderList.value)) {    case 1:      targetFolder = fileLocator.get(parent.hPrefWindow.getSpecialFolderKey("Documents"),                                      Components.interfaces.nsIFile);      targetFolder.append("My Downloads"); // XXXben localize      break;    case 2:      targetFolder = prefs.getComplexValue(downloadDirPref,                                            Components.interfaces.nsILocalFile);        break;    case 0:    default:                targetFolder = fileLocator.get(parent.hPrefWindow.getSpecialFolderKey("Desktop"),                                       Components.interfaces.nsIFile);      break;    }    prefs.setComplexValue(defaultFolderPref,                          Components.interfaces.nsILocalFile,                          targetFolder);  }  else if (prefs.prefHasUserValue(defaultFolderPref))    prefs.clearUserPref(defaultFolderPref);  }
meta: 5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5459/fbaac83522a2787d67799e6b203ab5db749b5595/pref-downloads.js/clean/browser/components/prefwindow/content/pref-downloads.js