mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
fixes bug 321833 "Clearing the cache prevents disk cache from working" r=mconnor, alfredkayser
This commit is contained in:
parent
5e00cb978a
commit
3aeb854c1a
@ -98,50 +98,9 @@ Sanitizer.prototype = {
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user