I clear the cache using this method:
var classID = Components.classes["@mozilla.org/network/cache-service;1"];
var cacheService =
classID.getService(Components.interfaces.nsICacheService);
var c = Components.interfaces.nsICache;
cacheService.evictEntries(c.STORE_ON_DISK);
I tried c.STORE_ANYWHERE too but I still get the cached images. This
worked for older version of XULRunner and it works in a chrome window
using XUL but not in the html window.
Any idea what could be the cause? Will the iframe cache not be cleared
anymore?
Thanks
Daniel
> In my XULRunner application I have an iframe containing a html
> document. When changing images referenced in the html document I still
> get the old (cached) images.
>
> I clear the cache using this method:
>
> var classID = Components.classes["@mozilla.org/network/cache-service;1"];
> var cacheService =
> classID.getService(Components.interfaces.nsICacheService);
> var c = Components.interfaces.nsICache;
> cacheService.evictEntries(c.STORE_ON_DISK);
>
> I tried c.STORE_ANYWHERE too but I still get the cached images.
The image cache no longer uses the cache service, instead it has its own
cache. Sorry, but I don't know whether it's possible to clear the image
cache, maybe someone else can help.
--
Warning: May contain traces of nuts.
You guys made my day! I struggled for hours now and with your help the
solution took 5 minutes. Here is my code which does the trick:
var classID = Components.classes["@mozilla.org/image/cache;1"];
var cacheService = classID.getService(Components.interfaces.imgICache);
cacheService.clearCache(false);
I've found the helpful source at
http://www.oxymoronical.com/experiments/xpcomref/applications/Firefox/3.6a1pre/interfaces/imgICache
Thanks a lot for the fast answer!
Daniel
So to really clear *all* the cache, you would need to use both? Are
there other classes for other content types?