Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

addProgressListener

瀏覽次數:76 次
跳到第一則未讀訊息

Pengyu Hong

未讀,
2006年11月23日 凌晨1:09:142006/11/23
收件者:
Anyone has experience with addProgressListener to share?

Appreciate!

Pengyu


Marco Balestra

未讀,
2006年11月23日 清晨5:16:512006/11/23
收件者:
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

未讀,
2006年11月23日 上午11:26:142006/11/23
收件者:
Thanks a lot! It works nicely.

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

Ziv....@gmail.com

未讀,
2006年12月26日 上午8:41:502006/12/26
收件者:
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

未讀,
2007年5月23日 清晨6:25:012007/5/23
收件者: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

未讀,
2007年5月25日 上午8:03:052007/5/25
收件者: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

未讀,
2007年5月28日 上午8:03:292007/5/28
收件者: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

未讀,
2007年5月28日 上午11:04:532007/5/28
收件者:
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 則新訊息