mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
[quikcjs] Removed optimisation
No DupValue. There were errors reported by valgrind
This commit is contained in:
parent
c9e1dd93cc
commit
64343791dd
@ -1014,23 +1014,14 @@ getForm(JSContext *ctx, struct form *form)
|
|||||||
#ifdef ECMASCRIPT_DEBUG
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
JSValue second;
|
|
||||||
static int initialized;
|
static int initialized;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
|
||||||
second = attr_find_in_map(map_form, (void *)form);
|
|
||||||
|
|
||||||
if (!JS_IsNull(second)) {
|
|
||||||
JSValue r = JS_DupValue(ctx, second);
|
|
||||||
RETURN_JS(r);
|
|
||||||
}
|
|
||||||
JS_NewClassID(&js_form_class_id);
|
JS_NewClassID(&js_form_class_id);
|
||||||
JS_NewClass(JS_GetRuntime(ctx), js_form_class_id, &js_form_class);
|
JS_NewClass(JS_GetRuntime(ctx), js_form_class_id, &js_form_class);
|
||||||
|
}
|
||||||
JSValue form_obj = JS_NewObjectClass(ctx, js_form_class_id);
|
JSValue form_obj = JS_NewObjectClass(ctx, js_form_class_id);
|
||||||
|
|
||||||
JS_SetPropertyFunctionList(ctx, form_obj, js_form_proto_funcs, countof(js_form_proto_funcs));
|
JS_SetPropertyFunctionList(ctx, form_obj, js_form_proto_funcs, countof(js_form_proto_funcs));
|
||||||
form_SetOpaque(form_obj, form);
|
form_SetOpaque(form_obj, form);
|
||||||
js_form_set_items2(ctx, form_obj, form);
|
js_form_set_items2(ctx, form_obj, form);
|
||||||
|
@ -1518,7 +1518,6 @@ void js_input_finalizer(JSRuntime *rt, JSValue val)
|
|||||||
struct form_state *fs = (struct form_state *)JS_GetOpaque(val, js_input_class_id);
|
struct form_state *fs = (struct form_state *)JS_GetOpaque(val, js_input_class_id);
|
||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
fs->ecmascript_obj = JS_NULL;
|
|
||||||
attr_erase_from_map(map_inputs, (void *)fs);
|
attr_erase_from_map(map_inputs, (void *)fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1590,19 +1589,12 @@ getInput(JSContext *ctx, struct form_state *fs)
|
|||||||
#ifdef ECMASCRIPT_DEBUG
|
#ifdef ECMASCRIPT_DEBUG
|
||||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
JSValue second;
|
|
||||||
static int initialized;
|
static int initialized;
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
JS_NewClassID(&js_input_class_id);
|
JS_NewClassID(&js_input_class_id);
|
||||||
JS_NewClass(JS_GetRuntime(ctx), js_input_class_id, &js_input_class);
|
JS_NewClass(JS_GetRuntime(ctx), js_input_class_id, &js_input_class);
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
second = attr_find_in_map(map_inputs, (void *)fs);
|
|
||||||
|
|
||||||
if (!JS_IsNull(second)) {
|
|
||||||
JSValue r = JS_DupValue(ctx, second);
|
|
||||||
RETURN_JS(r);
|
|
||||||
}
|
|
||||||
JSValue input_obj = JS_NewObjectClass(ctx, js_input_class_id);
|
JSValue input_obj = JS_NewObjectClass(ctx, js_input_class_id);
|
||||||
|
|
||||||
JS_SetPropertyFunctionList(ctx, input_obj, js_input_proto_funcs, countof(js_input_proto_funcs));
|
JS_SetPropertyFunctionList(ctx, input_obj, js_input_proto_funcs, countof(js_input_proto_funcs));
|
||||||
|
Loading…
Reference in New Issue
Block a user