Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Recognizing page load failure
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris Ross  
View profile  
 More options Dec 1 2011, 11:15 am
Newsgroups: mozilla.dev.extensions
From: Chris Ross <cr...@markmonitor.com>
Date: Thu, 01 Dec 2011 11:15:02 -0500
Local: Thurs, Dec 1 2011 11:15 am
Subject: Recognizing page load failure

   I have an extension that is already using a WebProgessListener to
watch for the user switching between different tabs so that it can
display and hide a toolbar when only the relevant tabs are displayed.

   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.

   I am looking at
https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads ,
which sounds like where I should be, but I don't see anything in there,
or the nsIWebProgress or nsIWebProgressListener that seem to relate to
the ultimate success or failure of loading a document.

   I put dump() statements in all of the onLocationChange,
onStateChange, onProgressChange, and onStatusChange in my listener, but
can't identify any calls to those methods that give me the information
I'm looking for.

   Any suggestions as to what I'm missing?  Thanks...

                                   - Chris

--
Chris Ross
chris.r...@markmonitor.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Dec 2 2011, 5:25 am
Newsgroups: mozilla.dev.extensions
From: Neil <n...@parkwaycc.co.uk>
Date: Fri, 02 Dec 2011 10:25:21 +0000
Local: Fri, Dec 2 2011 5:25 am
Subject: Re: Recognizing page load failure

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »