}
node = qjs_xml_node(cx, v, NULL);
- JS_FreeValue(cx, v);
if (node == NULL) {
+ JS_FreeValue(cx, v);
goto error;
}
if (qjs_xml_tree_has_namespaces(node)) {
+ JS_FreeValue(cx, v);
JS_ThrowTypeError(cx, "setval[%u] has namespaces", i);
goto error;
}
node = xmlDocCopyNode(node, current->doc->doc, 1);
+ JS_FreeValue(cx, v);
if (node == NULL) {
JS_ThrowInternalError(cx, "xmlDocCopyNode() failed");
goto error;
return xml.serializeToString(doc);
},
expected: `<root><child>value</child></root>` },
+ { doc: `<root></root>`,
+ skip: () => !has_quickjs(),
+ get: (doc) => {
+ let values = [];
+
+ Object.defineProperty(values, '0', {
+ get: () => xml.parse(`<child>value</child>`),
+ });
+ Object.defineProperty(values, 'length', {value: 1});
+
+ doc.root.$tags = values;
+ return xml.serializeToString(doc);
+ },
+ expected: `<root><child>value</child></root>` },
{ doc: `<root><target><old>value</old></target></root>`,
skip: () => !has_quickjs(),
get: (doc) => {