mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[quickjs] Removed some maps. Tests passed again.
This commit is contained in:
parent
019af02645
commit
de0977cd7b
@ -217,7 +217,7 @@ quickjs_done(struct module *xxx)
|
||||
interp_delete_map(map_interp);
|
||||
|
||||
if (quickjs_runtime) {
|
||||
//JS_FreeRuntime(quickjs_runtime);
|
||||
JS_FreeRuntime(quickjs_runtime);
|
||||
}
|
||||
// if (js_module_init_ok)
|
||||
// spidermonkey_runtime_release();
|
||||
|
@ -125,8 +125,6 @@ void js_attr_finalizer(JSRuntime *rt, JSValue val)
|
||||
REF_JS(val);
|
||||
dom_attr *node = (dom_attr *)JS_GetOpaque(val, js_attr_class_id);
|
||||
|
||||
attr_erase_from_map_str(map_attrs, node);
|
||||
|
||||
if (node) {
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "Before: %s:%d\n", __FUNCTION__, __LINE__);
|
||||
@ -146,7 +144,6 @@ getAttr(JSContext *ctx, void *node)
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
JSValue second = JS_NULL;
|
||||
static int initialized;
|
||||
/* create the element class */
|
||||
if (!initialized) {
|
||||
@ -154,22 +151,12 @@ getAttr(JSContext *ctx, void *node)
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_attr_class_id, &js_attr_class);
|
||||
initialized = 1;
|
||||
}
|
||||
second = attr_find_in_map(map_attrs, node);
|
||||
|
||||
if (!JS_IsNull(second)) {
|
||||
JSValue r = JS_DupValue(ctx, second);
|
||||
|
||||
RETURN_JS(r);
|
||||
}
|
||||
|
||||
JSValue attr_obj = JS_NewObjectClass(ctx, js_attr_class_id);
|
||||
|
||||
JS_SetPropertyFunctionList(ctx, attr_obj, js_attr_proto_funcs, countof(js_attr_proto_funcs));
|
||||
JS_SetClassProto(ctx, js_attr_class_id, attr_obj);
|
||||
JS_SetOpaque(attr_obj, node);
|
||||
|
||||
attr_save_in_map(map_attrs, node, attr_obj);
|
||||
|
||||
JSValue rr = JS_DupValue(ctx, attr_obj);
|
||||
|
||||
RETURN_JS(rr);
|
||||
|
@ -290,7 +290,6 @@ js_attributes_finalizer(JSRuntime *rt, JSValue val)
|
||||
void *attrs = js_attributes_GetOpaque(val);
|
||||
|
||||
js_attributes_SetOpaque(val, NULL);
|
||||
attr_erase_from_map_str(map_attributes, attrs);
|
||||
|
||||
if (attrs) {
|
||||
dom_namednodemap_unref(attrs);
|
||||
@ -308,7 +307,6 @@ getAttributes(JSContext *ctx, void *node)
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
JSValue second = JS_NULL;
|
||||
static int initialized;
|
||||
/* create the element class */
|
||||
if (!initialized) {
|
||||
@ -317,20 +315,12 @@ getAttributes(JSContext *ctx, void *node)
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_attributes_class_id, &js_attributes_class);
|
||||
initialized = 1;
|
||||
}
|
||||
second = attr_find_in_map(map_attributes, node);
|
||||
|
||||
if (!JS_IsNull(second)) {
|
||||
JSValue r = JS_DupValue(ctx, second);
|
||||
|
||||
RETURN_JS(r);
|
||||
}
|
||||
JSValue attributes_obj = JS_NewArray(ctx);
|
||||
JS_SetClassProto(ctx, js_attributes_class_id, JS_DupValue(ctx, attributes_obj));
|
||||
JS_SetPropertyFunctionList(ctx, attributes_obj, js_attributes_proto_funcs, countof(js_attributes_proto_funcs));
|
||||
|
||||
js_attributes_SetOpaque(attributes_obj, node);
|
||||
js_attributes_set_items(ctx, attributes_obj, node);
|
||||
attr_save_in_map(map_attributes, node, attributes_obj);
|
||||
|
||||
JSValue rr = JS_DupValue(ctx, attributes_obj);
|
||||
|
||||
|
@ -1922,7 +1922,6 @@ static const JSCFunctionListEntry js_doctype_proto_funcs[] = {
|
||||
};
|
||||
|
||||
void *map_doctypes;
|
||||
//static std::map<void *, JSValueConst> map_doctypes;
|
||||
|
||||
static void
|
||||
js_doctype_finalizer(JSRuntime *rt, JSValue val)
|
||||
@ -1930,7 +1929,6 @@ js_doctype_finalizer(JSRuntime *rt, JSValue val)
|
||||
REF_JS(val);
|
||||
|
||||
dom_node *node = (dom_node *)JS_GetOpaque(val, js_doctype_class_id);
|
||||
attr_erase_from_map_str(map_doctypes, node);
|
||||
|
||||
if (node) {
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
@ -1975,7 +1973,6 @@ getDoctype(JSContext *ctx, void *node)
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
JSValue second;
|
||||
static int initialized;
|
||||
/* create the element class */
|
||||
if (!initialized) {
|
||||
@ -1983,17 +1980,10 @@ getDoctype(JSContext *ctx, void *node)
|
||||
JS_NewClass(JS_GetRuntime(ctx), js_doctype_class_id, &js_doctype_class);
|
||||
initialized = 1;
|
||||
}
|
||||
second = attr_find_in_map(map_doctypes, node);
|
||||
|
||||
if (!JS_IsNull(second)) {
|
||||
JSValue r = JS_DupValue(ctx, second);
|
||||
RETURN_JS(r);
|
||||
}
|
||||
JSValue doctype_obj = JS_NewObjectClass(ctx, js_doctype_class_id);
|
||||
JS_SetPropertyFunctionList(ctx, doctype_obj, js_doctype_proto_funcs, countof(js_doctype_proto_funcs));
|
||||
JS_SetClassProto(ctx, js_doctype_class_id, doctype_obj);
|
||||
JS_SetOpaque(doctype_obj, node);
|
||||
attr_save_in_map(map_doctypes, node, doctype_obj);
|
||||
|
||||
JSValue rr = JS_DupValue(ctx, doctype_obj);
|
||||
RETURN_JS(rr);
|
||||
|
@ -3092,7 +3092,10 @@ js_element_getAttributeNode(JSContext *ctx, JSValueConst this_val, int argc, JSV
|
||||
}
|
||||
//dom_node_unref(el);
|
||||
|
||||
return getAttr(ctx, attr);
|
||||
JSValue ret = getAttr(ctx, attr);
|
||||
JS_FreeValue(ctx, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static JSValue
|
||||
|
Loading…
x
Reference in New Issue
Block a user