From 68065096aef744ccb1b8d5ab0ee85b1fcaadd2b6 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Wed, 17 May 2006 02:39:36 +0000 Subject: [PATCH] fixing review comments for Bug 298429 --- suite/common/pref/pref-cache.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/suite/common/pref/pref-cache.js b/suite/common/pref/pref-cache.js index 2b2a1b8d1cf8..be9673eba04e 100644 --- a/suite/common/pref/pref-cache.js +++ b/suite/common/pref/pref-cache.js @@ -8,15 +8,15 @@ const nsIProperties = Components.interfaces.nsIProperties; const kCacheParentDirPref = "browser.cache.disk.parent_directory"; var gFolderField; -var dir; +var gCacheParentDirectory; function Startup() { var prefWindow = parent.hPrefWindow; gFolderField = document.getElementById("browserCacheDiskCacheFolder"); - dir = prefWindow.getPref("localfile", kCacheParentDirPref); - if (dir == "!/!ERROR_UNDEFINED_PREF!/!") + gCacheParentDirectory = prefWindow.getPref("localfile", kCacheParentDirPref); + if (gCacheParentDirectory == "!/!ERROR_UNDEFINED_PREF!/!") { try { @@ -24,19 +24,19 @@ function Startup() var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"] .getService(nsIProperties); if (dirSvc.has("ProfLD")) - dir = dirSvc.get("ProfLD", nsILocalFile); + gCacheParentDirectory = dirSvc.get("ProfLD", nsILocalFile); else - dir = dirSvc.get("ProfD", nsILocalFile); + gCacheParentDirectory = dirSvc.get("ProfD", nsILocalFile); } catch (ex) { - dir = null; + gCacheParentDirectory = null; } } // if both pref and dir svc fail leave this field blank else show directory - if (dir) - gFolderField.value = (/Mac/.test(navigator.platform)) ? dir.leafName : dir.path; + if (gCacheParentDirectory) + gFolderField.value = (/Mac/.test(navigator.platform)) ? gCacheParentDirectory.leafName : gCacheParentDirectory.path; document.getElementById("chooseDiskCacheFolder").disabled = prefWindow.getPrefIsLocked(kCacheParentDirPref); @@ -53,7 +53,7 @@ function prefCacheSelectFolder() fp.init(window, title, nsIFilePicker.modeGetFolder); - fp.displayDirectory = dir; + fp.displayDirectory = gCacheParentDirectory; fp.appendFilters(nsIFilePicker.filterAll); var ret = fp.show(); @@ -62,6 +62,8 @@ function prefCacheSelectFolder() var localFile = fp.file.QueryInterface(nsILocalFile); prefWindow.setPref("localfile", kCacheParentDirPref, localFile); gFolderField.value = (/Mac/.test(navigator.platform)) ? fp.file.leafName : fp.file.path; + + gCacheParentDirectory = fp.file; } }