current->node = node;
current->doc = doc;
- doc->ref_count++;
ret = JS_NewObjectClass(cx, QJS_CORE_CLASS_ID_XML_NODE);
if (JS_IsException(ret)) {
return ret;
}
+ doc->ref_count++;
JS_SetOpaque(ret, current);
return ret;
return 0;
}
- if (pdesc != NULL) {
- pdesc->flags = JS_PROP_ENUMERABLE;
- pdesc->getter = JS_UNDEFINED;
- pdesc->setter = JS_UNDEFINED;
- pdesc->value = value;
+ if (pdesc == NULL) {
+ JS_FreeValue(cx, value);
+ return 1;
}
+ pdesc->flags = JS_PROP_ENUMERABLE;
+ pdesc->getter = JS_UNDEFINED;
+ pdesc->setter = JS_UNDEFINED;
+ pdesc->value = value;
+
return 1;
}
return -1;
}
- if (pdesc != NULL) {
- pdesc->flags = JS_PROP_ENUMERABLE;
- pdesc->getter = JS_UNDEFINED;
- pdesc->setter = JS_UNDEFINED;
- pdesc->value = value;
+ if (pdesc == NULL) {
+ JS_FreeValue(cx, value);
+ return 1;
}
+ pdesc->flags = JS_PROP_ENUMERABLE;
+ pdesc->getter = JS_UNDEFINED;
+ pdesc->setter = JS_UNDEFINED;
+ pdesc->value = value;
+
return 1;
}
return 0;
}
- if (pdesc != NULL) {
- pdesc->flags = JS_PROP_ENUMERABLE;
- pdesc->getter = JS_UNDEFINED;
- pdesc->setter = JS_UNDEFINED;
- pdesc->value = value;
+ if (pdesc == NULL) {
+ JS_FreeValue(cx, value);
+ return 1;
}
+ pdesc->flags = JS_PROP_ENUMERABLE;
+ pdesc->getter = JS_UNDEFINED;
+ pdesc->setter = JS_UNDEFINED;
+ pdesc->value = value;
+
return 1;
}
current->node = node;
current->doc = doc;
- doc->ref_count++;
ret = JS_NewObjectClass(cx, QJS_CORE_CLASS_ID_XML_ATTR);
if (JS_IsException(ret)) {
return ret;
}
+ doc->ref_count++;
JS_SetOpaque(ret, current);
return ret;
{ get: (doc) => doc.note.to.$attrs.b, expected: 'bar' },
{ get: (doc) => doc.note.to.$attr$b, expected: 'bar' },
{ get: (doc) => doc.note.$attr$a, expected: undefined },
+ { get: (doc) => '$attr$a' in doc.note.to, expected: true },
+ { get: (doc) => '$attr$missing' in doc.note.to, expected: false },
+ { get: (doc) => 'to' in doc.note, expected: true },
+ { get: (doc) => 'missing' in doc.note, expected: false },
+ { get: (doc) => '$tags$to' in doc.note, expected: true },
{ get: (doc) => Array.isArray(doc.note.$tags), expected: true },
{ get: (doc) => doc.note.$tags[0].$text, expected: 'Tove' },
{ get: (doc) => doc.note.$tags[1].$text, expected: 'Jani' },