In JSAPI versions 1.8 and later,
JSFunction is the type of
Function objects. It can be thought of as a subclass of
In earlier JSAPI versions, a
JSFunction represented the code of a function, not the function object itself. The distinction is significant in the case of closures. Different closures generated from the same source code would sometimes share the same
JSFunction. As a result, APIs (such as
JS_CallFunction) that operate on
JSFunctions often did not work properly on closures. This will be fixed in SpiderMonkey 1.8, when released.