Hey guys, I know this is probably an easy task but I don't know how to clear the cache on the MozRepl, or either that I really don't know my javascript anyway.
The cache I wanted to clear is the Memory cache, i searched around and i came to this
function clearcachebutton_clearCache()
{
var cacheService = getCacheService();
var alertService = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService);
var loc = new localizedStrings();
try
{
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
notify(loc.popupTitle, loc.successMessage);
}
catch(exception)
{
notify("Exception", exception);
}
//
// return a reference to the cache service
//
function getCacheService()
{
var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"];
var service = cacheClass.getService(Components.interfaces.nsICacheService);
return service;
}
// Notify user
function notify(title, body)
{
alertService.showAlertNotification("chrome://clearcache/skin/logo_32.png", title, body, false, "", null);
}
}
I tried sending the commands with this:
and
So far I'm only recieving errors back. Can anyone help me? I could get an addon but then i would have to study the javascript in the addon itself wouldn't I?
The cache I wanted to clear is the Memory cache, i searched around and i came to this
function clearcachebutton_clearCache()
{
var cacheService = getCacheService();
var alertService = Components.classes["@mozilla.org/alerts-service;1"].getService(Components.interfaces.nsIAlertsService);
var loc = new localizedStrings();
try
{
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);
cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);
notify(loc.popupTitle, loc.successMessage);
}
catch(exception)
{
notify("Exception", exception);
}
//
// return a reference to the cache service
//
function getCacheService()
{
var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"];
var service = cacheClass.getService(Components.interfaces.nsICacheService);
return service;
}
// Notify user
function notify(title, body)
{
alertService.showAlertNotification("chrome://clearcache/skin/logo_32.png", title, body, false, "", null);
}
}
I tried sending the commands with this:
[ code='text' ] ( Popup )
_FFCmd("cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);")
and
[ code='text' ] ( Popup )
_FFCmd("cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY);")
So far I'm only recieving errors back. Can anyone help me? I could get an addon but then i would have to study the javascript in the addon itself wouldn't I?