1 /* Better compatibility across versions of SpiderMonkey. */
9 #include "ecmascript/spidermonkey/util.h"
11 /** An ELinks-specific replacement for JS_DefineFunctions().
13 * @relates spidermonkeyFunctionSpec */
15 spidermonkey_DefineFunctions(JSContext
*cx
, JSObject
*obj
,
16 const spidermonkeyFunctionSpec
*fs
)
18 for (; fs
->name
; fs
++) {
19 if (!JS_DefineFunction(cx
, obj
, fs
->name
, fs
->call
,
26 /** An ELinks-specific replacement for JS_InitClass().
28 * @relates spidermonkeyFunctionSpec */
30 spidermonkey_InitClass(JSContext
*cx
, JSObject
*obj
,
31 JSObject
*parent_proto
, JSClass
*clasp
,
32 JSNative constructor
, uintN nargs
,
34 const spidermonkeyFunctionSpec
*fs
,
35 JSPropertySpec
*static_ps
,
36 const spidermonkeyFunctionSpec
*static_fs
)
38 JSObject
*proto
= JS_InitClass(cx
, obj
, parent_proto
, clasp
,
40 ps
, NULL
, static_ps
, NULL
);
46 if (!spidermonkey_DefineFunctions(cx
, proto
, fs
))
51 JSObject
*cons_obj
= JS_GetConstructor(cx
, proto
);
55 if (!spidermonkey_DefineFunctions(cx
, cons_obj
, static_fs
))