7121 Posted November 24, 2012 Share Posted November 24, 2012 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: _FFCmd("cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK);") and _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? Link to comment Share on other sites More sharing options...
Danp2 Posted November 24, 2012 Share Posted November 24, 2012 You have to define "cacheService" before you can use it. Try this:_FFCmd('var cacheService = Components.classes["@mozilla.org/network/cache-service;1"].getService(Components.interfaces.nsICacheService);') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
7121 Posted November 25, 2012 Author Share Posted November 25, 2012 Thank you DAN, i beleive you are right, i took a look at the patterning and it appears you have to do some combining and I didn't know how to combine the functions haha so I believe this will work. I'm going to try it now. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now