mirror of
https://github.com/rkd77/elinks.git
synced 2025-09-21 19:46:23 -04:00
SMJS: Use JS_GetInstancePrivate where applicable.
This is a further precaution against reading a pointer from the wrong type of object. All of the JS_GetPrivate calls were already protected with JS_InstanceOf checks if assertions are enabled, and many of them also if assertions are not enabled.
This commit is contained in:
committed by
Kalle Olavi Niemitalo
parent
b53525e98e
commit
99f648b911
@@ -32,7 +32,8 @@ smjs_action_fn_finalize(JSContext *ctx, JSObject *obj)
|
||||
assert(JS_InstanceOf(ctx, obj, (JSClass *) &action_fn_class, NULL));
|
||||
if_assert_failed return;
|
||||
|
||||
hop = JS_GetPrivate(ctx, obj); /* from @action_fn_class */
|
||||
hop = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &action_fn_class, NULL);
|
||||
|
||||
if (hop) mem_free(hop);
|
||||
}
|
||||
@@ -55,7 +56,8 @@ smjs_action_fn_callback(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
|
||||
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 */
|
||||
hop = JS_GetInstancePrivate(ctx, fn_obj,
|
||||
(JSClass *) &action_fn_class, NULL);
|
||||
if (!hop) return JS_TRUE;
|
||||
|
||||
if (argc >= 1) {
|
||||
|
Reference in New Issue
Block a user