| Author |
xmlRequest.onprogress questions
|
|
| Michael Vincent van Rantwijk 2005-09-28, 6:29 am |
| What properties are there for:
xmlRequest = new XMLHttpRequest();
xmlRequest.onprogress = onXMLProgress <-
onXMLProgress: function(aEvent)
{
aEvent.target points to the request, but what else can I use?
How do I get the progress percentage and total size?
}
Thank you,
Michael
| |
| Neil Deakin 2005-09-28, 6:38 pm |
| Michael Vincent van Rantwijk wrote:
> What properties are there for:
>
> xmlRequest = new XMLHttpRequest();
> xmlRequest.onprogress = onXMLProgress <-
>
> onXMLProgress: function(aEvent)
> {
> aEvent.target points to the request, but what else can I use?
> How do I get the progress percentage and total size?
> }
The progress event is defined in the DOM load/save spec. You can use:
position
totalSize
/ Neil
| |
| Michael Vincent van Rantwijk 2005-09-28, 6:38 pm |
| Neil Deakin wrote:
> Michael Vincent van Rantwijk wrote:
>
> The progress event is defined in the DOM load/save spec. You can use:
>
> position
> totalSize
>
> / Neil
Thanks, but I tried that already. I used something like:
xmlRequest.onprogress = function(aEvent)
{
dump("\naEvent : " + aEvent +
"\nposition : " + aEvent.position +
"\ntotalSize: " + aEvent.totalSize);
}
xmlRequest.open("GET", url);
and the output is this:
aEvent : [object XMLHttpProgressEvent]
position : undefined
totalSize: undefined
so now what?
Michael
| |
| Christian Biesinger 2005-09-28, 6:38 pm |
| Michael Vincent van Rantwijk wrote:
> position : undefined
> totalSize: undefined
Hm... does it help to explicitly QI aEvent to nsIDOMLSProgressEvent?
| |
| Michael Vincent van Rantwijk 2005-09-28, 6:38 pm |
| Christian Biesinger wrote:
> Michael Vincent van Rantwijk wrote:
>
> Hm... does it help to explicitly QI aEvent to nsIDOMLSProgressEvent?
Eh, how? Like this:
aEvent.QueryInterface(Components.interfaces.nsIDOMLSProgressEvent).position
Tanks,
Michael
| |
| Martin Honnen 2005-09-28, 6:38 pm |
|
Michael Vincent van Rantwijk wrote:
> xmlRequest.onprogress = function(aEvent)
> {
> dump("\naEvent : " + aEvent +
> "\nposition : " + aEvent.position +
> "\ntotalSize: " + aEvent.totalSize);
> }
> xmlRequest.open("GET", url);
>
> and the output is this:
>
> aEvent : [object XMLHttpProgressEvent]
Can't help with your problem but I am wondering since when onprogress
works at all, I do not even get it fired with a Firefox 1.5 beta
nightly. Is onprogress a new feature on the trunk only?
--
Martin Honnen
http://JavaScript.FAQTs.com/
| |
| Michael Vincent van Rantwijk 2005-09-28, 6:38 pm |
| Martin Honnen wrote:
>
>
> Michael Vincent van Rantwijk wrote:
>
>
>
> Can't help with your problem but I am wondering since when onprogress
> works at all, I do not even get it fired with a Firefox 1.5 beta
> nightly. Is onprogress a new feature on the trunk only?
No problem, and it's not a trunk only (new) think.
BTW: it should get triggered with:
xmlRequest.onprogress = function(aEvent) {}
xmlRequest.open("GET", url) ?
but it will fail when you use:
xmlRequest.open("GET", url) ?
xmlRequest.onprogress = function(aEvent) {}
I only hope this helps,
Michael
| |
| Christian Biesinger 2005-09-28, 10:34 pm |
| Michael Vincent van Rantwijk wrote:
> Eh, how? Like this:
>
> aEvent.QueryInterface(Components.interfaces.nsIDOMLSProgressEvent).position
Yes.
| |
| Michael Vincent van Rantwijk 2005-09-29, 6:30 pm |
| Christian Biesinger wrote:
> Michael Vincent van Rantwijk wrote:
>
> Yes.
I got this error:
Error: [JavaScript Error: "[Exception... "Could not convert JavaScript
argument (NULL value cannot
be used for a C++ reference type) arg 0 [nsISupports.QueryInterface]"
nsresult:
"0x8057000b (NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF)" location: "JS frame
:: ...
so I checked nsIDOMLSProgressEvent but that is undefined!
Michael
| |
| Michael Vincent van Rantwijk 2005-09-29, 6:30 pm |
| Michael Vincent van Rantwijk wrote:
> Christian Biesinger wrote:
>
> I got this error:
>
> Error: [JavaScript Error: "[Exception... "Could not convert JavaScript
> argument (NULL value cannot
> be used for a C++ reference type) arg 0 [nsISupports.QueryInterface]"
> nsresult:
> "0x8057000b (NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF)" location: "JS frame
> :: ...
>
> so I checked nsIDOMLSProgressEvent but that is undefined!
and the output for this:
dump("\nnsIDOMEvent: " + Components.interfaces.nsIDOMEvent);
dump("\nnsIDOMLSProgressEvent: +
Components.interfaces.nsIDOMLSProgressEvent);
is this:
nsIDOMEvent: nsIDOMEvent
nsIDOMLSProgressEvent: undefined
in SeaMonkey build 2005092006
I hope this helps,
Michael
| |
| Christian Biesinger 2005-09-29, 6:30 pm |
| Michael Vincent van Rantwijk wrote:
> nsIDOMEvent: nsIDOMEvent
> nsIDOMLSProgressEvent: undefined
> in SeaMonkey build 2005092006
Hmm. Do you have a dom_loadsave.xpt file in the GRE\components directory?
| |
| Michael Vincent van Rantwijk 2005-09-29, 10:29 pm |
| Christian Biesinger wrote:
> Michael Vincent van Rantwijk wrote:
>
> Hmm. Do you have a dom_loadsave.xpt file in the GRE\components directory?
No, I don't have such file.
Michael
| |
| Michael Vincent van Rantwijk 2005-09-30, 6:33 pm |
| Christian Biesinger wrote:
> Michael Vincent van Rantwijk wrote:
>
> Hmm. Do you have a dom_loadsave.xpt file in the GRE\components directory?
I copied this file from a ZIP file (thanks to Phil) into the component
directory and removed compreg.dat / xpti.dat and restarted SeaMonkey,
and now everything works as expected. So why isn't this file part of the
'normal' SeaMonkey builds?
Michael
| |
| Christian Biesinger 2005-09-30, 10:23 pm |
| Michael Vincent van Rantwijk wrote:
> I copied this file from a ZIP file (thanks to Phil) into the component
> directory and removed compreg.dat / xpti.dat and restarted SeaMonkey,
> and now everything works as expected. So why isn't this file part of the
> 'normal' SeaMonkey builds?
Should probably file a bug on this...
https://bugzilla.mozilla.org/show_bug.cgi?id=302444 was supposed to fix
this.
| |
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |