Re: GC and jsdIStackFrame.script.functionObject.getWrappedValue();

"Adam L. Peller" <[email protected]> Wed, 8 Aug 2007 15:30:56 -0400
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
> "John J. Barton" <[email protected]> writes:
> In Firebug I had this line:
>   var fn = frame.script.functionObject.getWrappedValue();
> As far as I can tell this line prevented the script from being
> destroyed, even if I issue
>   fn = null;
> directly after it.  Is it possible?

John, I haven't done much xpcom in a while, but it sort of makes
sense.  If you're grabbing an xpcom object to pass across a language
boundary, the engine, being a good xpcom citizen, probably does an
addRef() to grab the object and to keep the object from being GC'd.
Since the XPCOM GC doesn't know anything about JS references or JS GC,
it would probably be up to you to call nsISupports::release() in this
instance.  I don't see anything explicit about this in the docs,
however.  I guess you'd have to do this anytime you deal with raw
nsISupports pointers across xpconnect?

-Adam