fixes bug 321833 "Clearing the cache prevents disk cache from working" r=mconnor, alfredkayser
authordarin@meer.net
Tue, 02 Oct 2007 20:35:28 -0700
changeset 6578 cf65f1235cff9231c6450b1f71a2c4d10543892e
parent 6577 e0a9035a419cd258d09c305dce1317f80df2eb07
child 6579 50dac1e47049b9d4fc420ae16b4c3f489e15d611
push idunknown
push userunknown
push dateunknown
reviewersmconnor, alfredkayser
bugs321833
milestone1.9a9pre
fixes bug 321833 "Clearing the cache prevents disk cache from working" r=mconnor, alfredkayser
browser/modules/Sanitizer.jsm
--- a/browser/modules/Sanitizer.jsm
+++ b/browser/modules/Sanitizer.jsm
@@ -93,60 +93,19 @@ Sanitizer.prototype = {
   items: {
     cache: {
       clear: function ()
       {
         const cc = Components.classes;
         const ci = Components.interfaces;
         var cacheService = cc["@mozilla.org/network/cache-service;1"]
                              .getService(ci.nsICacheService);
-
-        // Here we play dirty, trying to brutally wipe out all the cache files 
-        // even if the disk cache device has gone away (if it is still with us,
-        // our removal attempt will fail because the directory is locked,
-        // and we fall back to the "nice" way below)
-        
-        var cacheDir;
-        // Look at nsCacheProfilePrefObserver::ReadPrefs()
-        // and nsDiskCacheDevice::SetCacheParentDirectory()
-        // for details on how we guess the cache directory
         try {
-          cacheDir = cc["@mozilla.org/preferences-service;1"]
-                       .getService(ci.nsIPrefBranch)
-                       .getComplexValue("browser.cache.disk.parent_directory",
-                                        ci.nsILocalFile);
-        } catch(er) {
-          const dirServ = cc["@mozilla.org/file/directory_service;1"]
-                            .getService(ci.nsIProperties);
-          try {
-            cacheDir = dirServ.get("cachePDir",ci.nsILocalFile);
-          } catch(er) {
-            cacheDir = dirServ.get("ProfLD",ci.nsILocalFile);
-          }
-        }
-        
-        if (cacheDir) {
-          // Here we try to prevent the "phantom Cache.Trash" issue
-          // reported in bug #296256
-          cacheDir.append("Cache.Trash");
-          try {
-            cacheDir.remove(true);
-          } catch(er) {}
-          cacheDir = cacheDir.parent;
-          cacheDir.append("Cache");
-          try {
-           cacheDir.remove(true);
-          } catch(er) {}
-        }
-        
-        try {
-          // The "nice" way
           cacheService.evictEntries(ci.nsICache.STORE_ANYWHERE);
         } catch(er) {}
-        
       },
       
       get canClear()
       {
         return true;
       }
     },