On Dec 4, 2005, at 5:46 PM, tdir wrote:
I have seen very odd behavior when playing around with XMLHttpRequest
(I'm using FireFox 1.0.7 under windoze/xp). I create a single instance
of XMLHttpRequest, store in a global var 'xmlHttpReq'. I have a
function called using onclick of an img; the funct does
'xmlHttpReq.onreadystatechange = myStateChangeHandler' (the latter
is a
global func), then open() and send(). Everything works fine. But if I
tried to get the value of the onreadystatechange callback (e.g., 'var
xxx = xmlHttpReq.onreadystatechange') I get an error 'permission
denied
to create wrapper for object of class UnnamedClass'.
I can reproduce that here with Firefox 1.0.7 and 1.5 on Mac OS X.
I'm not sure why you'd need to read that property anyway, but you
might want to report a bug with Mozilla to see if this was
intentional or not.
Have you seen this behavior with Mochikit? Do you recommend re-using a
request object - or creating a new one for each request (which seems
unnecessary). I'm trying to climb the learning curve for using
MochiKit.Async - but feel like I'd better get the basics down before I
try fancier stuff like Async.
MochiKit never reuses an XMLHttpRequest object. It's possible to
have a couple of them in flight at the same time, but certainly not
if you keep reusing the same object. Reusing the same object sounds
pretty pointless and error prone.
-bob