mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05: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:
parent
b53525e98e
commit
99f648b911
@ -98,7 +98,8 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
ses = doc_view->session;
|
||||
@ -203,7 +204,8 @@ document_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
|
||||
|
@ -134,7 +134,9 @@ static unicode_val_T jsval_to_accesskey(JSContext *ctx, jsval *vp);
|
||||
static struct form_state *
|
||||
input_get_form_state(JSContext *ctx, JSObject *obj, struct view_state *vs)
|
||||
{
|
||||
int n = (int)(long)JS_GetPrivate(ctx, obj);
|
||||
int n = (int)(long)JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &input_class,
|
||||
NULL);
|
||||
|
||||
return &vs->form_info[n];
|
||||
}
|
||||
@ -169,7 +171,8 @@ input_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
fs = input_get_form_state(ctx, obj, vs);
|
||||
@ -319,7 +322,8 @@ input_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
fs = input_get_form_state(ctx, obj, vs);
|
||||
@ -442,7 +446,8 @@ input_click(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
ses = doc_view->session;
|
||||
@ -494,7 +499,8 @@ input_focus(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
ses = doc_view->session;
|
||||
@ -632,10 +638,12 @@ form_elements_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
form_view = JS_GetInstancePrivate(ctx, parent_form,
|
||||
(JSClass *) &form_class, NULL);
|
||||
form = find_form_by_form_view(document, form_view);
|
||||
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
@ -688,10 +696,12 @@ form_elements_item(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
form_view = JS_GetInstancePrivate(ctx, parent_form,
|
||||
(JSClass *) &form_class, NULL);
|
||||
form = find_form_by_form_view(document, form_view);
|
||||
|
||||
if (argc != 1)
|
||||
@ -745,10 +755,12 @@ form_elements_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
form_view = JS_GetPrivate(ctx, parent_form); /* from @form_class */
|
||||
form_view = JS_GetInstancePrivate(ctx, parent_form,
|
||||
(JSClass *) &form_class, NULL);
|
||||
form = find_form_by_form_view(document, form_view);
|
||||
|
||||
if (argc != 1)
|
||||
@ -849,9 +861,10 @@ form_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
fv = JS_GetInstancePrivate(ctx, obj, (JSClass *) &form_class, NULL);
|
||||
form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -981,9 +994,10 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
fv = JS_GetInstancePrivate(ctx, obj, (JSClass *) &form_class, NULL);
|
||||
form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -1060,9 +1074,10 @@ form_reset(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
fv = JS_GetInstancePrivate(ctx, obj, (JSClass *) &form_class, argv);
|
||||
form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -1095,10 +1110,11 @@ form_submit(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
ses = doc_view->session;
|
||||
fv = JS_GetPrivate(ctx, obj); /* from @form_class */
|
||||
fv = JS_GetInstancePrivate(ctx, obj, (JSClass *) &form_class, argv);
|
||||
form = find_form_by_form_view(doc_view->document, fv);
|
||||
|
||||
assert(form);
|
||||
@ -1181,7 +1197,8 @@ forms_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
|
||||
@ -1225,7 +1242,8 @@ forms_item(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
|
||||
if (argc != 1)
|
||||
return JS_TRUE;
|
||||
@ -1265,7 +1283,8 @@ forms_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
document = doc_view->document;
|
||||
|
||||
|
@ -164,7 +164,8 @@ location_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_TRUE;
|
||||
@ -205,7 +206,8 @@ location_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
|
@ -98,7 +98,8 @@ unibar_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
status = &doc_view->session->status;
|
||||
bar = JS_GetPrivate(ctx, obj); /* from @menubar_class or @statusbar_class */
|
||||
@ -156,7 +157,8 @@ unibar_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
assert(JS_InstanceOf(ctx, parent_win, (JSClass *) &window_class, NULL));
|
||||
if_assert_failed return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, parent_win); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, parent_win,
|
||||
(JSClass *) &window_class, NULL);
|
||||
doc_view = vs->doc_view;
|
||||
status = &doc_view->session->status;
|
||||
bar = JS_GetPrivate(ctx, obj); /* from @menubar_class or @statusbar_class */
|
||||
|
@ -132,7 +132,7 @@ window_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &window_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj, (JSClass *) &window_class, NULL);
|
||||
|
||||
/* No need for special window.location measurements - when
|
||||
* location is then evaluated in string context, toString()
|
||||
@ -264,7 +264,7 @@ window_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &window_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj, (JSClass *) &window_class, NULL);
|
||||
|
||||
if (JSVAL_IS_STRING(id)) {
|
||||
if (!strcmp(jsval_to_string(ctx, &id), "location")) {
|
||||
@ -318,7 +318,7 @@ window_alert(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
|
||||
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &window_class, argv)) return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj, (JSClass *) &window_class, argv);
|
||||
|
||||
if (argc != 1)
|
||||
return JS_TRUE;
|
||||
@ -349,7 +349,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &window_class, argv)) return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @window_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj, (JSClass *) &window_class, argv);
|
||||
doc_view = vs->doc_view;
|
||||
ses = doc_view->session;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -90,7 +90,8 @@ bookmark_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
bookmark = JS_GetPrivate(ctx, obj); /* from @bookmark_class */
|
||||
bookmark = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &bookmark_class, NULL);
|
||||
|
||||
if (!bookmark) return JS_FALSE;
|
||||
|
||||
@ -137,7 +138,8 @@ bookmark_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
bookmark = JS_GetPrivate(ctx, obj); /* from @bookmark_class */
|
||||
bookmark = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &bookmark_class, NULL);
|
||||
|
||||
if (!bookmark) return JS_FALSE;
|
||||
|
||||
@ -211,7 +213,8 @@ bookmark_folder_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &bookmark_folder_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
folder = JS_GetPrivate(ctx, obj); /* from @bookmark_folder_class */
|
||||
folder = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &bookmark_folder_class, NULL);
|
||||
|
||||
*vp = JSVAL_NULL;
|
||||
|
||||
|
@ -49,7 +49,8 @@ cache_entry_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
cached = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &cache_entry_class, NULL);
|
||||
|
||||
if (!cache_entry_is_valid(cached)) return JS_FALSE;
|
||||
|
||||
@ -112,7 +113,8 @@ cache_entry_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
cached = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &cache_entry_class, NULL);
|
||||
|
||||
if (!cache_entry_is_valid(cached)) return JS_FALSE;
|
||||
|
||||
@ -164,7 +166,8 @@ cache_entry_finalize(JSContext *ctx, JSObject *obj)
|
||||
assert(JS_InstanceOf(ctx, obj, (JSClass *) &cache_entry_class, NULL));
|
||||
if_assert_failed return;
|
||||
|
||||
cached = JS_GetPrivate(ctx, obj); /* from @cache_entry_class */
|
||||
cached = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &cache_entry_class, NULL);
|
||||
|
||||
if (!cached) return;
|
||||
|
||||
|
@ -25,7 +25,9 @@ smjs_globhist_item_finalize(JSContext *ctx, JSObject *obj)
|
||||
assert(JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL));
|
||||
if_assert_failed return;
|
||||
|
||||
history_item = JS_GetPrivate(ctx, obj); /* from @smjs_globhist_item_class */
|
||||
history_item = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &smjs_globhist_item_class,
|
||||
NULL);
|
||||
|
||||
if (history_item) object_unlock(history_item);
|
||||
}
|
||||
@ -60,7 +62,9 @@ smjs_globhist_item_get_property(JSContext *ctx, JSObject *obj, jsval id,
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
history_item = JS_GetPrivate(ctx, obj); /* from @smjs_globhist_item_class */
|
||||
history_item = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &smjs_globhist_item_class,
|
||||
NULL);
|
||||
|
||||
if (!history_item) return JS_FALSE;
|
||||
|
||||
@ -123,7 +127,9 @@ smjs_globhist_item_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &smjs_globhist_item_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
history_item = JS_GetPrivate(ctx, obj); /* from @smjs_globhist_item_class */
|
||||
history_item = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &smjs_globhist_item_class,
|
||||
NULL);
|
||||
|
||||
if (!history_item) return JS_FALSE;
|
||||
|
||||
|
@ -29,7 +29,8 @@ keymap_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &keymap_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
data = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &keymap_class, NULL);
|
||||
|
||||
keystroke_str = JS_GetStringBytes(JS_ValueToString(ctx, id));
|
||||
if (!keystroke_str) goto ret_null;
|
||||
@ -83,7 +84,8 @@ keymap_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &keymap_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
data = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &keymap_class, NULL);
|
||||
|
||||
/* Ugly fact: we need to get the string from the id to give to bind_do,
|
||||
* which will of course then convert the string back to an id... */
|
||||
@ -155,7 +157,8 @@ keymap_finalize(JSContext *ctx, JSObject *obj)
|
||||
assert(JS_InstanceOf(ctx, obj, (JSClass *) &keymap_class, NULL));
|
||||
if_assert_failed return;
|
||||
|
||||
data = JS_GetPrivate(ctx, obj); /* from @keymap_class */
|
||||
data = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &keymap_class, NULL);
|
||||
|
||||
mem_free(data);
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ view_state_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &view_state_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @view_state_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &view_state_class, NULL);
|
||||
|
||||
undef_to_jsval(ctx, vp);
|
||||
|
||||
@ -89,7 +90,8 @@ view_state_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, obj, (JSClass *) &view_state_class, NULL))
|
||||
return JS_FALSE;
|
||||
|
||||
vs = JS_GetPrivate(ctx, obj); /* from @view_state_class */
|
||||
vs = JS_GetInstancePrivate(ctx, obj,
|
||||
(JSClass *) &view_state_class, NULL);
|
||||
|
||||
if (!JSVAL_IS_INT(id))
|
||||
return JS_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user