Mike Thompson wrote:
Kyle,
I took a look at the original message posted to n.p.m.dom, and this comment caught my attention:
Specifically, I want the contents of the
cached page as they are displayed in the above example, but I need to
parse and manipulate them before I display anything in the browser.
It looks like you are trying to not only read the page source, but you want to directly manipulate what the browser has cached? is that right?
If so, that is going to be a bit challenging. First of all, just because you have a "page descriptor" or "cache key", it does not guarantee that the page will be fetched from the cache. In fact, the page may not necessarily exist in the cache.
There are potentially better places to hook into Gecko if you are wanting to manipulate the content it loads. Can you provide a bit more information about what you are tying to accomplish?
Thanks,
Darin
Hi, I'm in the same boat. I have a Firefox extension that allows a user to right-click on an image and send the image to an external application (paint, etc). Thing is, I can't figure out how to extract the image out of the cache. Ideally, I want the extension to just send the original URL and have my win32 app extract the image from the cache itself. Barring that, if I could somehow extract the image myself (in firefox) and pass the local path to the win32 app, it would work nicely too. I hope I explained this clearly.
Any ideas?
Thanks, Mike.
_______________________________________________
Mozilla-netlib mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-netlib
Perhaps you should use nsIDownloader. It gives you a nsIFile referencing the downloaded file. If the file lives in the cache, then you will get a pointer to the file in the cache (no extra work). If the file is in the cache, but not stored as a separate file (i.e., as a sequence of blocks in one of the _CACHE_00X_ files), then nsIDownloader will copy the file out of the cache and give you a reference to a temporary file on disk. Otherwise, it will go ahead and download the file to a temporary location and give you a reference to that file.
You use it in conjunction with nsIChannel. nsIDownloader is actually just a subclass of nsIStreamListener, so once you configure your nsIDownloader instance, you can pass it to nsIChannel::asyncOpen. You'll want to configure a nsIChannel for your URL just as you would if you were loading the URL normally.
http://lxr.mozilla.org/mozilla/source/netwerk/base/public/nsIDownloader.idl
See nsJARChannel.cpp for an example of nsIDownloader being used internally by Mozilla.
-Darin _______________________________________________ Mozilla-netlib mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-netlib