1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[quickjs] JS_FreeValue

This commit is contained in:
Witold Filipczyk 2023-01-21 18:34:34 +01:00
parent c97d0c0690
commit 1d6b9dd86a
2 changed files with 28 additions and 11 deletions

View File

@ -243,6 +243,8 @@ js_htmlCollection_set_items(JSContext *ctx, JSValue this_val, void *node)
if (name != "" && name != "item" && name != "namedItem") { if (name != "" && name != "item" && name != "namedItem") {
JS_DefinePropertyValueStr(ctx, this_val, name.c_str(), JS_DupValue(ctx, obj), 0); JS_DefinePropertyValueStr(ctx, this_val, name.c_str(), JS_DupValue(ctx, obj), 0);
} }
JS_FreeValue(ctx, obj);
counter++; counter++;
} }
} }

View File

@ -104,7 +104,10 @@ js_document_get_property_anchors(JSContext *ctx, JSValueConst this_val)
return JS_NULL; return JS_NULL;
} }
return getCollection(ctx, elements); JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
RETURN_JS(rr);
} }
static JSValue static JSValue
@ -586,7 +589,10 @@ js_document_get_property_images(JSContext *ctx, JSValueConst this_val)
return JS_NULL; return JS_NULL;
} }
return getCollection(ctx, elements); JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
RETURN_JS(rr);
} }
static JSValue static JSValue
@ -646,8 +652,10 @@ js_document_get_property_links(JSContext *ctx, JSValueConst this_val)
if (elements->size() == 0) { if (elements->size() == 0) {
return JS_NULL; return JS_NULL;
} }
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
static JSValue static JSValue
@ -813,8 +821,10 @@ js_document_get_property_scripts(JSContext *ctx, JSValueConst this_val)
if (elements->size() == 0) { if (elements->size() == 0) {
return JS_NULL; return JS_NULL;
} }
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
static JSValue static JSValue
@ -1368,10 +1378,11 @@ js_document_getElementsByClassName(JSContext *ctx, JSValueConst this_val, int ar
if (!elements) { if (!elements) {
return JS_NULL; return JS_NULL;
} }
*elements = root->find(xpath); *elements = root->find(xpath);
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
static JSValue static JSValue
@ -1420,10 +1431,11 @@ js_document_getElementsByName(JSContext *ctx, JSValueConst this_val, int argc, J
if (!elements) { if (!elements) {
return JS_NULL; return JS_NULL;
} }
*elements = root->find(xpath); *elements = root->find(xpath);
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
static JSValue static JSValue
@ -1469,10 +1481,11 @@ js_document_getElementsByTagName(JSContext *ctx, JSValueConst this_val, int argc
if (!elements) { if (!elements) {
return JS_NULL; return JS_NULL;
} }
*elements = root->find(xpath); *elements = root->find(xpath);
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
static JSValue static JSValue
@ -1575,8 +1588,10 @@ js_document_querySelectorAll(JSContext *ctx, JSValueConst this_val, int argc, JS
*elements = root->find(xpath); *elements = root->find(xpath);
} catch (xmlpp::exception &e) { } catch (xmlpp::exception &e) {
} }
JSValue rr = getCollection(ctx, elements);
JS_FreeValue(ctx, rr);
return getCollection(ctx, elements); RETURN_JS(rr);
} }
#if 0 #if 0