W3C home > Mailing lists > Public > public-webapi@w3.org > August 2007

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 13 Aug 2007 22:01:07 -0500
Message-ID: <46C11AF3.3050009@mit.edu>
To: Dan Connolly <connolly@w3.org>
CC: public-webapi@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:58 GMT