Chris Ross wrote:
> I'm want to be able to test, when the tab is opened and attempts to
> load a document, if that fails. Due to any sort of connection
> failure, or a 500-class response code.
For a connection failure, you will typically get an error page; you can
detect this using Components.isSuccessCode(aRequest.status). Do this in
the onLocationChange method of your listener. Note that sometimes
aRequest is null when it shouldn't be, so you need to check that first.
For a response code, you have to see if the request was an HTTP request
using if (aRequest instanceof Components.interfaces.nsHTTPChannel); if
that succeeds you can then read the request.responseStatus. I don't know
when the best time to check that is, but you might be lucky and find out
that onLocationChange works here too.
Warning: May contain traces of nuts.