Getting NS_IMAGELIB_ERROR_FAILURE, can't tell why!
I have created my own protocol handler (in C++) and when I tell
Firefox to load a page using my scheme ("mxhp:test"), Firefox calls up
my handler, gets the html page, and displays it. Almost.
For some reason, the <img> tags inside my HTML page (for example <img
src="mxhp:dude.png">) are not being loaded correctly. However, if I
right-click on the image in the HTML page and select "View Image" it
shows up correctly, so _most_ of my code is working correctly.
I'm spitting out all kinds of logging to a file, and here's what I see
when the HTML page tries to load the PNG image.
CMyProtocol::NewURI() gets called with the correct URI for the PNG
CMyProtocol::NewChannel() gets called, I create a CMyChannel object
(great class names, eh?)
CMyChannel::SetUri() gets called, I load the PNG image, ready to
CMyChannel::SetLoadGroup() gets called
CMyChannel::AsyncOpen() gets called - since I have the data, I don't
need to do anything async, so instead I:
- call mLoadGroup->AddRequest(NS_STATIC_CAST(nsIRequest*, this),
aContext), it succeeds
- call mListener->OnStartRequest() which does these things:
- - calls CMyChannel::GetContentType(), I return "image/png"
- - calls CMyChannel::GetLoadFlags(), I return zero
- - calls CMyChannel::GetOriginalURI(), I return the URI
- - calls CMyProtocol::GetProtocolFlags(), I return zero
- - calls CMyChannel::GetLoadFlags(), I return zero (again)
- - calls CMyChannel::Cancel(NS_IMAGELIB_ERROR_FAILURE) !!!!!!!!!
and it goes downhill from there.
The big difference I see, when I load the PNG directly (not as part of
an HTML file), is that after my CMyChannel::SetUri() gets called,
Firefox then calls CMyChannel::SetLoadFlags(0x80000) and then a little
later CMyChannel::SetLoadFlags(0x290000), something that doesn't
happen when it's loading the PNG as part of the HTML.
Any suggestions where I can start looking, to figure out why this is