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

Bug 1027, SMJS: make null mean "none" in elinks.keymaps

elinks.keymaps.main["/"] = null;
used to crash ELinks with a segfault in JS_ObjectIsFunction.
Fix that by recognizing JSVAL_NULL explicitly and treating it as "none".
Likewise, if keymap_get_property would return "none" to ECMAScript,
return JSVAL_NULL instead.
This commit is contained in:
Kalle Olavi Niemitalo 2008-07-11 16:37:44 +03:00 committed by Kalle Olavi Niemitalo
parent 783b52a41e
commit 555dbf7da0
2 changed files with 9 additions and 1 deletions

2
NEWS
View File

@ -10,6 +10,8 @@ ELinks 0.11.4.GIT now:
To be released as 0.11.5.
* critical bug 1027 in user SMJS: make elinks.keymaps treat null and
"none" as equivalent actions, avoiding a segfault
* build bug 1021: fixed uninitialized variable in http_got_header
ELinks 0.11.4:

View File

@ -37,7 +37,7 @@ keymap_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
action_str = get_action_name_from_keystroke((enum keymap_id) *data,
keystroke_str);
if (!action_str) goto ret_null;
if (!action_str || !strcmp(action_str, "none")) goto ret_null;
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, action_str));
@ -106,6 +106,12 @@ keymap_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
return JS_TRUE;
} else if (JSVAL_IS_NULL(*vp)) { /* before JSVAL_IS_OBJECT */
if (bind_do(keymap_str, keystroke_str, "none", 0))
return JS_FALSE;
return JS_TRUE;
} else if (JSVAL_IS_OBJECT(*vp)) {
unsigned char *err = NULL;
int event_id;