1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

smjs_action_fn_callback: Assert the type of the correct object.

We're calling JS_GetPrivate(ctx, fn_obj), so the JS_InstanceOf assertion
must also use fn_obj, rather than obj.

Reported by Miciah.
This commit is contained in:
Kalle Olavi Niemitalo 2006-12-02 01:15:07 +02:00 committed by Kalle Olavi Niemitalo
parent f52d23c224
commit 39e97921f7

View File

@ -45,7 +45,6 @@ smjs_action_fn_callback(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
struct smjs_action_fn_callback_hop *hop;
JSObject *fn_obj;
assert(JS_InstanceOf(ctx, obj, (JSClass *) &action_fn_class, NULL));
assert(smjs_ctx);
if_assert_failed return JS_FALSE;
@ -53,6 +52,8 @@ smjs_action_fn_callback(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
if (JS_TRUE != JS_ValueToObject(ctx, argv[-2], &fn_obj))
return JS_TRUE;
assert(JS_InstanceOf(ctx, fn_obj, (JSClass *) &action_fn_class, NULL));
if_assert_failed return JS_FALSE;
hop = JS_GetPrivate(ctx, fn_obj); /* from @action_fn_class */
if (!hop) return JS_TRUE;