I'm pretty sure XMLHttpRequest doesn't have to addref becuase it uses an nsCOMPtr for it's callback object, and using nsCOMPtr automatically addrefs the object. I had one implementatin where I used a regular pointer to point to the javascript callback and that implementation crashed when I tried to call the callback after the SetCallback function exited. Adding and addref call fixed the problem. Next, I tried using an nsCOMPtr object and this implementation worked without doing an addref.
I have a feeling you object is a little different than mine. My object creates a thread (using the NSPR thread library included with mozilla source) that continues to run after the javascript code exits. The callback works fine until the javascript code exits. Does your callback work after your javascript code exits? _______________________________________________ Mozilla-xpcom mailing list Mozilla-xpcom@mozilla.org http://mail.mozilla.org/listinfo/mozilla-xpcom