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

addProgressListener

76 views
Skip to first unread message

Pengyu Hong

unread,
Nov 23, 2006, 1:09:14 AM11/23/06
to
Anyone has experience with addProgressListener to share?

Appreciate!

Pengyu


Marco Balestra

unread,
Nov 23, 2006, 5:16:51 AM11/23/06
to
Pengyu Hong <ho...@cs.brandeis.edu> wrote:

> Anyone has experience with addProgressListener to share?

// Associate the progress listener for a "browser" to a listener object:

browserObject.addProgressListener( listObj,
Components.interfaces.nsIWebProgress.NOTIFY_STATE_WINDOW );


// Remember to define the object, something like this:

listObj = new Object();

listObj.wpl = Components.interfaces.nsIWebProgressListener;

listObj.QueryInterface = function(aIID) {
if (aIID.equals(listObj.wpl) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports)) return this;
throw Components.results.NS_NOINTERFACE;
}

listObj.onStateChange = function(aProgress, aRequest, aFlag, aStatus) {
if (aFlag & listObj.wpl.STATE_START) {
// This fires when the load event is initiated
} else {
if (aFlag & listObj.wpl.STATE_STOP) {
if ( aFlag & listObj.wpl.STATE_IS_WINDOW ) {
// This fires when ALL load finish
}
if ( aFlag & listObj.wpl.STATE_IS_NETWORK ) {
// Fires when ALL load are REALLY over,
// do something "final" here
// (my two cents)
} else {
// This fires when a load finishes
}
}
}
return 0;
}

// This fires when the location bar changes i.e load event is confirmed
// or when the user switches tabs
listObj.onLocationChange = function(aProgress, aRequest, aURI) {
// do whatever you want to do
return 0;
}

// For definitions of the remaining functions see XulPlanet.com
listObj.onProgressChange = function() { return 0 };
listObj.onStatusChange = function() { return 0 };
listObj.onSecurityChange = function() { return 0 };
listObj.onLinkIconAvailable = function() { return 0 };

/*
I use the progress listener to trap the end of a local HTML
"template" file loading, and run XSLT transormations.
In addition I need to evaluate the browser contentDocument DOM
in order to clean "target" attributes on links, and so on.

HTH
*/
--
Fletto i muscoli e sono nel vuoto

Pengyu Hong

unread,
Nov 23, 2006, 11:26:14 AM11/23/06
to
Thanks a lot! It works nicely.

"Marco Balestra" <bale...@faqintosh.com> wrote in message
news:1hp955a.14sclu0tw6a7oN%bale...@faqintosh.com...

Ziv....@gmail.com

unread,
Dec 26, 2006, 8:41:50 AM12/26/06
to
Hi Pengyu Hong,
I'm also trying to add a progress listener to the browser object from
my XPCOM code.
How can I get a reference to the main browser (i.e what is
browserObject)?
Thanks,
Ziv

Oliveiros Cristina

unread,
May 23, 2007, 6:25:01 AM5/23/07
to Marco Balestra, dev-te...@lists.mozilla.org
Hello, Marco.

This thread is quite old, but I would like to resume it due to a situation
that I am experiencing.
My question is, on the sequence you described, where will the DOM
unloadevent of the former page be generated? Is it possible that it
will be
generated after the onLocationChange event?

Thanks in advance for your help

Cheers,
Oliveiros

2006/11/23, Marco Balestra <bale...@faqintosh.com>:

> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>

Oliveiros Cristina

unread,
May 25, 2007, 8:03:05 AM5/25/07
to Oliveiros Cristina, Marco Balestra, dev-te...@lists.mozilla.org
Marco doesn't seem to be around on this list..

Can anyone else please help me with this question, please ?

Thanks in advance

Cheers,
Oliveiros


----- Original Message -----
From: "Oliveiros Cristina" <oliveiros...@gmail.com>
To: "Marco Balestra" <bale...@faqintosh.com>
Cc: <dev-te...@lists.mozilla.org>
Sent: Wednesday, May 23, 2007 11:25 AM
Subject: Re: addProgressListener


> Hello, Marco.
>
> This thread is quite old, but I would like to resume it due to a situation
> that I am experiencing.
> My question is, on the sequence you described, where will the DOM
> unloadevent of the former page be generated? Is it possible that it
> will be
> generated after the onLocationChange event?
>
> Thanks in advance for your help
>
> Cheers,
> Oliveiros
>
> 2006/11/23, Marco Balestra <bale...@faqintosh.com>:
>>

Oliveiros Cristina

unread,
May 28, 2007, 8:03:29 AM5/28/07
to Oliveiros Cristina, Marco Balestra, dev-te...@lists.mozilla.org
Howdy, List.

Can anyone please kindly help me?

If this is not the right list for this question, please kindly redirect me
to the appropriate list please

Thanx in advance

Kind Regards,

Michael Vincent van Rantwijk, MultiZilla

unread,
May 28, 2007, 11:04:53 AM5/28/07
to
Oliveiros Cristina wrote:
> Howdy, List.
>
> Can anyone please kindly help me?
>
> If this is not the right list for this question, please kindly redirect
> me to the appropriate list please

-> extensions or DOM.

> Thanx in advance

0 new messages