Hi,
Actually I am facing a problem quite similar like yours. What I did is I
called the AddRef of the object passed in, to prevent it from being removed
from memory when its reference counter is 0. I noticed that the
XMLHttpRequest sample doesn't seem to do this, but what I did works!!!
In addition, I do not understand why XMLHttpRequest save and restore
context, as I am able to call the callback without saving and restoring the
context.
Regards,
Kok Hoor
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm writing an xpcom object that requires callback functinality similar
> to the xmlhttprequest object. This is what I have so far:
>
> [scriptable, uuid(43524)]
> interface Callback : nsISupports
> {
> void CallbackFunc();
> };
>
> [scriptable, uuid(1234)]
> interface Device : nsISupports
> {
> attribute Callback objCallback;
> };
>
> In javascript, I create an object that has a function called
> callBackFunc() and I use the setCallBack function of the Device object
> to set the callback object. After setting the callback object, I'm
> able to call the javascript function until the javascript code exits.
> Then, when the device object tries to call the callback, the program
> hangs. I took a look at the xmlhttprequest code to get some pointers
> and found that that object uses a few javascript objects to save the
> current javascript context. After adding similar code, I get a 'too
> much recursion' error when I call the callback object. Does anyone
> have any suggestins?
>
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom