Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trouble loading image over custom nsIHttpChannel

3 views
Skip to first unread message

StijnSanders

unread,
Jul 2, 2009, 9:08:10 AM7/2/09
to
I'm building an nsIProtocolHandler implementation. My channel class
implements nsIHttpChannel. Loading simple pages so far works, but I
seem to run into a problem when my page wants to display images.

I have a page "a.html" with this simple HTML:

<img src="a.png">

Both "xxm://test/a.html" and "xxm://test/a.png" work in Firefox, and
give above HTML or the PNG image data. The problem is with displaying
the HTML page, the image doesn't get loaded. When I debug, I see:

- NewChannel gets called for a.png, (when Firefox is processing an
OnDataAvailable notice on a.html),
- NotificationCallbacks is set (I only need to keep a reference,
right?)
- RequestHeader "Accept" is set to "image/png,image/*;q=0.8,*/*;q=0.5"
- but then, the channel object is released (most probably due to a
zero reference count)

Looking at other requests, I would expect some other properties to get
set (such as LoadFlags or OriginalURI) and AsyncOpen to get called,
from where I can start getting the request responded to.

I've been looking around in the vast library of source-code (using
mxr.mozilla.org/firefox), and find only one instance of the "Accept"
string that get's added to the request headers:
http://preview.tinyurl.com/le7m77
It queries for nsIHttpChannelInternal right after creating a new
channel, but I don't even get this QueryInterface call through...
The debugger I use doesn't appear to catch any exceptions, but I guess
something is throwing something.

I also find it worrisome that I'm required to implement a permanently
non-frozen interface to get images on pages to work...
http://mxr.mozilla.org/firefox/source/netwerk/protocol/http/public/nsIHttpChannelInternal.idl#44

Greetings
Stijn

0 new messages