On Fri, 4 Nov 2005, Boris Zbarsky wrote:
Scott Lanning wrote:
The header for nsIWebProgressListener isn't clear
to me at all.

What is unclear?  If there's a problem, we can fix it; we just need
to know what the problem is.

[Sorry if my message was a little trollish.]
I guess I just get confused easily or something.
When I start reading nsIWebProgressListener.h,
it says it's "implemented by clients wishing to listen in on
the progress associated with the loading of asynchronous
requests in the context of a nsIWebProgress instance".
So I ask myself, what's an nsIWebProgress instance?
"The nsIWebProgress interface is used to add or remove
nsIWebProgressListener instances to observe the loading
of asynchronous requests". It seems like I have this
running in circles experience a lot when trying to figure
this stuff out.
  Say that I figure out I need an nsIWebProgress instance
in order to call its AddProgressListener method. Nothing I see
in nsIWebProgress indicates how I can get one of them.
It seems I might use nsIWebBrowser->AddWebBrowserListener,
where what it says is nsIWeakReference is really my
nsIWebProgressListener. I found this by grepping the
gtkmozembed source code (in EmbedPrivate.cpp).
Gtkmozembed has a gtk_moz_embed_get_nsIWebBrowser method,
so I can get an nsIWebBrowser that way.
  Assuming the above is correct, to retrieve the HTTP status
code (200, 302, 404, etc.), I think I would be concerned
with OnStateChange in nsIWebProgressListener. Its documentation
says "NOTE: aStatus may be a success code even for server generated
errors, such as the HTTP 404 error. In such cases, the request itself
should be queried for extended error information (e.g., for HTTP requests
see nsIHttpChannel)."  I'm apparently to use nsIHttpChannel somehow.
How do I get one of those? I don't see anything in nsIRequest.
(I'm guessing that GetStatus method of nsIRequest will give me
the same thing as aStatus in OnStateChange?) I don't see HttpChannel
in gtkmozembed. Grepping more, I see that in EmbedProgress.cpp,
it do_QueryInterface an nsIRequest to an nsIChannel. And an
nsIHttpChannel is an nsIChannel. Maybe I could do_QueryInterface
to nsIHttpChannel, instead. Then finally I call GetResponseStatus
on the nsIHttpChannel object.
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to