Thanks to Christian, we now know the error is NS_ERROR_CACHE_KEY_NOT_FOUND.
As I am pretty sure I am using the right key, I presume creating my own cache session to obtain the entry descriptors is not the way to go.

As I don't have a way to obtain the cache session used by HTTP, I think what I want to do is simply not possible.

Instead of disabling cache entries selectively, I am going to invalidate the entire cache as a whole. This is a bit tough but that should do it.

/mig

Thank you Darin.
I have tried that already and I get an exception while calling nsICacheSession.openCacheEntry:

[Exception... "Component returned failure code: 0x804b003d [nsICacheSession.openCacheEntry]" nsresult: "0x804b003d (<unknown>)" location: "JS frame :: chrome://victor/content/vutil.js :: anonymous :: line 1542" data: no]

That's not very explicit, at least to me.

Darin Fisher wrote:

Try opening the cache entry after the visitor completes.  You cannot
open cache entries while visiting the cache.  Save a list of entries
keys (and cache client IDs) that you wish to doom, and then doom them
after you finish visiting.


 From my chrome application, I need to invalidate some cache entries of
HTML files, in order to make those pages be reloaded next time they are
displayed.

I use my own instance of nsICacheVisitor to walk through cached entries,
and I can locate the desired entries. However, the nsICacheVisitor API
only provides me with a nsICacheEntryInfo interface, while the method to
invalidate the entry is located in the nsICacheEntryDescriptor interface.

The only way I see to get an instance of nsICacheEntryDescriptor is to
use a method from interface nsICacheSession, openCacheEntry or
asyncOpenCacheEntry. Is there a "global" cache session I can get somewhere ?

If I create my own cache session with the createSession method of
@mozilla.org/network/cache-service;1, and use it to call openCacheEntry
or asyncOpenCacheEntry from my nsICacheVisitor instance, firefox enters
into some kind of deadlock and freezes.
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to