mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[quickjs] JS_FreeValue in forms
This commit is contained in:
parent
642b94f03f
commit
ac4e417a3c
@ -499,25 +499,20 @@ js_document_get_property_forms(JSContext *ctx, JSValueConst this_val)
|
||||
return JS_NULL;
|
||||
}
|
||||
|
||||
if (!document->forms_nodeset) {
|
||||
document->forms_nodeset = new(std::nothrow) xmlpp::Node::NodeSet;
|
||||
}
|
||||
|
||||
if (!document->forms_nodeset) {
|
||||
return JS_NULL;
|
||||
}
|
||||
|
||||
xmlpp::Document *docu = (xmlpp::Document *)document->dom;
|
||||
xmlpp::Element* root = (xmlpp::Element *)docu->get_root_node();
|
||||
xmlpp::ustring xpath = "//form";
|
||||
xmlpp::Node::NodeSet *elements = static_cast<xmlpp::Node::NodeSet *>(document->forms_nodeset);
|
||||
|
||||
xmlpp::Node::NodeSet *elements = new(std::nothrow) xmlpp::Node::NodeSet;
|
||||
*elements = root->find(xpath);
|
||||
|
||||
if (elements->size() == 0) {
|
||||
return JS_NULL;
|
||||
}
|
||||
JSValue rr = getForms(ctx, elements);
|
||||
JS_FreeValue(ctx, rr);
|
||||
|
||||
return getForms(ctx, elements);
|
||||
RETURN_JS(rr);
|
||||
}
|
||||
|
||||
static JSValue
|
||||
|
@ -196,6 +196,7 @@ js_form_set_items(JSContext *ctx, JSValueConst this_val, void *node)
|
||||
JS_SetPropertyStr(ctx, this_val, fc->name, JS_DupValue(ctx, obj));
|
||||
}
|
||||
}
|
||||
JS_FreeValue(ctx, obj);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
@ -239,6 +240,7 @@ js_form_set_items2(JSContext *ctx, JSValueConst this_val, void *node)
|
||||
JS_SetPropertyStr(ctx, this_val, fc->name, JS_DupValue(ctx, obj));
|
||||
}
|
||||
}
|
||||
JS_FreeValue(ctx, obj);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ js_forms_set_items(JSContext *ctx, JSValueConst this_val, void *node)
|
||||
JS_SetPropertyStr(ctx, this_val, form->name, JS_DupValue(ctx, v));
|
||||
}
|
||||
}
|
||||
JS_FreeValue(ctx, v);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
@ -1533,12 +1533,15 @@ quickjs_moved_form_state(struct form_state *fs)
|
||||
static
|
||||
void js_input_finalizer(JSRuntime *rt, JSValue val)
|
||||
{
|
||||
REF_JS(val);
|
||||
|
||||
struct form_state *fs = (struct form_state *)JS_GetOpaque(val, js_input_class_id);
|
||||
|
||||
JS_SetOpaque(val, nullptr);
|
||||
if (fs) {
|
||||
fs->ecmascript_obj = JS_NULL;
|
||||
map_inputs.erase(fs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static JSClassDef js_input_class = {
|
||||
|
Loading…
Reference in New Issue
Block a user