1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Bug 1029: Use JS_CallFunctionValue in keybinding.c

JS_CallFunction does not support closures in SpiderMonkey versions
earlier than 1.8.  Test case:

elinks.keymaps.main["\""] = function() {
    elinks.keymaps.main["e"] = function() {
	elinks.alert("hello!");
    };
}
This commit is contained in:
Kalle Olavi Niemitalo 2008-07-12 01:54:49 +03:00 committed by Kalle Olavi Niemitalo
parent e3830cfd67
commit c5a012eca5

View File

@ -55,15 +55,13 @@ smjs_keybinding_action_callback(va_list ap, void *data)
jsval rval;
struct session *ses = va_arg(ap, struct session *);
JSObject *jsobj = data;
JSFunction *func = JS_ValueToFunction(smjs_ctx, OBJECT_TO_JSVAL(jsobj));
evhook_use_params(ses);
assert(func);
smjs_ses = ses;
JS_CallFunction(smjs_ctx, NULL, func, 0, NULL, &rval);
JS_CallFunctionValue(smjs_ctx, NULL, OBJECT_TO_JSVAL(jsobj),
0, NULL, &rval);
smjs_ses = NULL;