mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[spidermonkey] fun dynamically allocated
This commit is contained in:
parent
298588ad18
commit
55979c1551
@ -334,6 +334,9 @@ ecmascript_put_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
foreach (t, interpreter->timeouts) {
|
||||
kill_timer(&t->tid);
|
||||
done_string(&t->code);
|
||||
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||
delete(t->fun);
|
||||
#endif
|
||||
#ifdef CONFIG_QUICKJS
|
||||
if (!JS_IsNull(t->fun)) {
|
||||
JS_FreeValue(t->ctx, t->fun);
|
||||
|
@ -490,8 +490,12 @@ ecmascript_timeout_handler2(void *val)
|
||||
assertm(interpreter->vs->doc_view != NULL,
|
||||
"setTimeout: vs with no document (e_f %d)",
|
||||
interpreter->vs->ecmascript_fragile);
|
||||
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||
JS::RootedValue vfun((JSContext *)interpreter->backend_data, *(t->fun));
|
||||
ecmascript_call_function(interpreter, vfun, NULL);
|
||||
#else
|
||||
ecmascript_call_function(interpreter, t->fun, NULL);
|
||||
|
||||
#endif
|
||||
if (t->timeout_next > 0) {
|
||||
install_timer(&t->tid, t->timeout_next, ecmascript_timeout_handler2, t);
|
||||
} else {
|
||||
@ -578,7 +582,7 @@ ecmascript_set_timeout2(void *c, JS::HandleValue f, int timeout, int timeout_nex
|
||||
t->ctx = ctx;
|
||||
t->timeout_next = timeout_next;
|
||||
JS::RootedValue fun((JSContext *)interpreter->backend_data, f);
|
||||
t->fun = fun;
|
||||
t->fun = new JS::Heap<JS::Value>(fun);
|
||||
add_to_list(interpreter->timeouts, t);
|
||||
install_timer(&t->tid, timeout, ecmascript_timeout_handler2, t);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||
#include <jsapi.h>
|
||||
#include <jsfriendapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_QUICKJS
|
||||
@ -107,7 +108,7 @@ struct ecmascript_interpreter {
|
||||
JSValueConst fun;
|
||||
#endif
|
||||
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||
JS::RootedValue fun;
|
||||
JS::Heap<JS::Value> *fun;
|
||||
#endif
|
||||
#ifdef CONFIG_MUJS
|
||||
const char *fun;
|
||||
@ -126,7 +127,7 @@ struct ecmascript_timeout {
|
||||
#endif
|
||||
#ifdef CONFIG_ECMASCRIPT_SMJS
|
||||
JSContext *ctx;
|
||||
JS::RootedValue fun;
|
||||
JS::Heap<JS::Value> *fun;
|
||||
#endif
|
||||
#ifdef CONFIG_MUJS
|
||||
js_State *ctx;
|
||||
|
Loading…
Reference in New Issue
Block a user