If i'm posting to the worng list, can you please point me to the
correct one.
Problem is:
I create an XHTTPRequest in a function and return the object which is
assigned to a varible.
I then use the varible to setup the request headers and open the
connection and send any post data required.
Before sending the post data I assign onload and onprogress. Only the
load function will execute after the request finishs and the onprogress
will never be called.
Now, if i assign onprogress in the function used to create my
XHTTPRequest object, onprogress function will get called.
Working Example:
function makeRequest() {
http_request = new XMLHttpRequest();
http_request.onprogress=doSomething;
return http_request;
}
rq = makeRequest();
... Setup rest of the request stuff
rq.onload=display;
rq.send( data );
Non-Working Example:
function makeRequest() {
http_request = new XMLHttpRequest();
return http_request;
}
rq = makeRequest();
... Setup rest of the request stuff
rq.onprogress=doSomething;
rq.onload=display;
rq.send( data );
The non-working example will never call doSomething, but the working
example will.
anyone know why? Did i miss something?
Please ignore typo's it's 3am and I'm really tired, they don't exist in
my real code.
Thanks in advance.
There's some code in open() that does things conditionally depending on whether
we have a progress listener. Therefore, for a progress listener to work it must
be set before open() is called.
The documentation does seem to lie about this, doesn't it? :(
-Boris
Cool, thanks, I thought i had missed something guess for a good reason.
I will keep this in mind. I do have a MDC account, but i will leave the
Documentation edits up to someone that is more farmilar with doing such
a task.
I filed bug https://bugzilla.mozilla.org/show_bug.cgi?id=361222 on the IDL
comments; once we sort those out we can update MDC too.
Like the bug says, we'll probably need to make an incompatible change here in
the 1.9 or later timeframe...
-Boris