Re: [XHR] can't get this.readyState to work

Dan Connolly wrote:
> function handler() {
>     alert("@@ handlder state, status:" + this.readyState + "/" +
> this.status);
> }
> 
> client.onreadystatechange = handler;
> 
> and I get undefined for this.readyState and this.status.
> 
> I'm using firefox 2.0.0.6 on ubuntu linux.

In Gecko 1.8 (Firefox 1.5 and Firefox 2), |this| is not bound to the 
XMLHttpRequest object when the onreadystatechange function is called.

In Gecko 1.9 it will be bound to the XMLHttpRequest object.  Similarly, 
event.target will be the XMLHttpRequest object in 1.9.

See https://bugzilla.mozilla.org/show_bug.cgi?id=198595 for details.

In other words, the example should work with, say, 
http://www.mozilla.org/projects/firefox/3.0a7/releasenotes/#downloadandinstall

-Boris

Received on Tuesday, 14 August 2007 03:01:23 UTC