Can I access/download files from the back-forward cache?

Question: Is it possible for an addon to download a file from the bfcache? If yes, how? I’m trying to prevent another hit to the server.

My current scenario: I wrote a custom addon (using addon sdk) for myself and currently I am able to download files from the regular cache using nsIWebBrowserPersist.saveURI(). However, there are some other files that are not being stored in the cache, so when I use saveURI(), it makes another request to the server. When I debug using Firebug, it looks like these other files are in the bfcache.

1 Like

In short, no you can’t access the bfcache in the way you want. It is a page cache rather than an individual file cache. A parsed HTML page, consisting of DOM nodes and associated javascript objects, is “frozen” so that it continues to exist in memory, but does not do anything. It can then be un-frozen very rapidly. Firebug will show you all sorts of things in those pages, just as if they were real live pages, but the individual files that made up the page may or may not still be stored anywhere.

Also, it is recommended that addons don’t use saveURI, not least because pre- and post- Firefox 36 versions are incompatible.