summaryrefslogtreecommitdiff
path: root/javascript/jsapi/dom.bnd
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-11-04 11:18:37 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-11-04 11:20:02 +0000
commit8de9e1907759de5de7ded43573417b2f2e471c04 (patch)
tree6666110bfe84e3d34a2c33e2d9159d8bb806acbd /javascript/jsapi/dom.bnd
parentf5a98defaec97cf7a18516c8c9af49f10b93f0cf (diff)
downloadnetsurf-8de9e1907759de5de7ded43573417b2f2e471c04.tar.gz
netsurf-8de9e1907759de5de7ded43573417b2f2e471c04.tar.bz2
improve dom reference accounting
Diffstat (limited to 'javascript/jsapi/dom.bnd')
-rw-r--r--javascript/jsapi/dom.bnd15
1 files changed, 10 insertions, 5 deletions
diff --git a/javascript/jsapi/dom.bnd b/javascript/jsapi/dom.bnd
index 14068ba2e..fdf1f253a 100644
--- a/javascript/jsapi/dom.bnd
+++ b/javascript/jsapi/dom.bnd
@@ -13,6 +13,7 @@ operation getElementById %{
}
exc = dom_document_get_element_by_id(private->node, elementId_dom, &element);
+ dom_string_unref(elementId_dom);
if (exc != DOM_NO_ERR) {
return JS_FALSE;
}
@@ -37,16 +38,14 @@ operation getElementsByTagName %{
return JS_FALSE;
}
- LOG(("here"));
-
exc = dom_document_get_elements_by_tag_name(private->node, localName_dom, /*&collection*/&nodelist);
+ dom_string_unref(localName_dom);
if (exc != DOM_NO_ERR) {
return JS_FALSE;
}
- LOG(("nodelist %p", nodelist));
if (/*collection*/nodelist != NULL) {
- /* jsret = jsapi_new_HTMLCollection(cx,
+ /*jsret = jsapi_new_HTMLCollection(cx,
NULL,
NULL,
collection,
@@ -65,8 +64,14 @@ getter textContent %{
dom_string *content;
exc = dom_node_get_text_content(private->node, &content);
- if ((exc == DOM_NO_ERR) && (content != NULL)) {
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (content != NULL) {
jsret = JS_NewStringCopyN(cx, dom_string_data(content), dom_string_length(content));
+ dom_string_unref(content);
+
}
%}