Re: How to check if a custom class has a private object set?

Boris Zbarsky <[email protected]> Fri, 16 Dec 2016 02:38:33 -0500
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 12/16/16 2:02 AM, Mihai Dobrescu wrote:
> Provided JS_GetPrivate returns some known-typed private object and JS_ObjectIsFunction checks if some specific class instance is there, how could I check if simply some object instance is present, regardless the class type?

JS_GetPrivate returns a void*.  It can be used (with JS_SetPrivate) to 
store some non-spidermonkey-related data on your object.  So I'm not 
sure where JS_ObjectIsFunction comes into this.

In general, if JS_GetPrivate returned something nonzero, that means 
something was stored with JS_SetPrivate.  I'm not sure whether that 
answers the question you're trying to ask, though, because I'm not sure 
what that question is.

-Boris