Hi,
I'm working with an application that embeds the XULrunner engine as
its browser engine.
I've run into a problem whereby if I empty the browser cache via calls
to nsICacheService->EvictEntries and then open a page, the page will
still have the previous cached images.
I think, but am open to correction, that the cache clearing goes on in
the background in another thread, and if I perform the new page open
quickly after the call to nsICacheService->EvictEntries the cache may
not yet be cleared and I may re-use the old images?
My reasoning for this is that an increasing sleep between the cache
empty call, and the page open call decreases the chance of the old
images being mistakenly re-used.
No sleep - 100% re-use of old images
5 second sleep - maybe 50% re-use
8 second sleep - mostly no re-use
20 second sleep - no re-use
I can't put a 20 second sleep in for obvious reasons ;) Does anybody
have any suggestions?
I've tried to look through the code, and to be honest, I just don't see
why this would be happening.
This is the code I use to clear the cache:
gboolean mozilla_clear_cache(void) {
nsresult result;
nsCOMPtr<nsICacheService> CacheService =
do_GetService(NS_CACHESERVICE_CONTRACTID, &result);
if (NS_FAILED(result)) {
return FALSE;
}
result = CacheService->EvictEntries(nsICache::STORE_ANYWHERE);
if (NS_FAILED(result)) { return FALSE; }
result = CacheService->EvictEntries(nsICache::STORE_IN_MEMORY);
if (NS_FAILED(result)) { return FALSE; }
result = CacheService->EvictEntries(nsICache::STORE_ON_DISK);
if (NS_FAILED(result)) { return FALSE; }
result = CacheService->EvictEntries(nsICache::STORE_ON_DISK_AS_FILE);
if (NS_FAILED(result)) { return FALSE; }
result = CacheService->EvictEntries(nsICache::STORE_OFFLINE);
if (NS_FAILED(result)) { return FALSE; }
return TRUE;
}
thanks a lot,
Greg
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding