diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-10-21 18:30:36 +0200 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2015-10-21 18:30:36 +0200 |
commit | 0ddb60d82acfa0b8bc967562d4a3672fd3780d20 (patch) | |
tree | bc4973b1b848f545e4e59b2254c097f2ab6bdcce /javascript/duktape | |
parent | 0645bc7570974531be344544b68a7e93908d1796 (diff) | |
download | netsurf-0ddb60d82acfa0b8bc967562d4a3672fd3780d20.tar.gz netsurf-0ddb60d82acfa0b8bc967562d4a3672fd3780d20.tar.bz2 |
Revert "The node acessors should return javacript null not an error"
This reverts commit 0645bc7570974531be344544b68a7e93908d1796.
Diffstat (limited to 'javascript/duktape')
-rw-r--r-- | javascript/duktape/Node.bnd | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/javascript/duktape/Node.bnd b/javascript/duktape/Node.bnd index 87d7e9292..3a723ddfb 100644 --- a/javascript/duktape/Node.bnd +++ b/javascript/duktape/Node.bnd @@ -132,18 +132,14 @@ getter Node::firstChild() dom_exception exc; dom_node *n; exc = dom_node_get_first_child(priv->node, &n); - if (exc != DOM_NO_ERR) { + if ((exc != DOM_NO_ERR) || (n == NULL)) { return 0; } - if (n == NULL) { - duk_push_null(ctx); - } else { - if (dukky_push_node(ctx, n) == false) { - dom_node_unref(n); - return 0; - } + if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); + return 0; } + dom_node_unref(n); return 1; %} @@ -152,18 +148,14 @@ getter Node::lastChild() dom_exception exc; dom_node *n; exc = dom_node_get_last_child(priv->node, &n); - if (exc != DOM_NO_ERR) { + if ((exc != DOM_NO_ERR) || (n == NULL)) { return 0; } - if (n == NULL) { - duk_push_null(ctx); - } else { - if (dukky_push_node(ctx, n) == false) { - dom_node_unref(n); - return 0; - } + if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); + return 0; } + dom_node_unref(n); return 1; %} @@ -172,18 +164,14 @@ getter Node::previousSibling() dom_exception exc; dom_node *n; exc = dom_node_get_previous_sibling(priv->node, &n); - if (exc != DOM_NO_ERR) { + if ((exc != DOM_NO_ERR) || (n == NULL)) { return 0; } - if (n == NULL) { - duk_push_null(ctx); - } else { - if (dukky_push_node(ctx, n) == false) { - dom_node_unref(n); - return 0; - } + if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); + return 0; } + dom_node_unref(n); return 1; %} @@ -192,18 +180,14 @@ getter Node::nextSibling() dom_exception exc; dom_node *n; exc = dom_node_get_next_sibling(priv->node, &n); - if (exc != DOM_NO_ERR) { + if ((exc != DOM_NO_ERR) || (n == NULL)) { return 0; } - if (n == NULL) { - duk_push_null(ctx); - } else { - if (dukky_push_node(ctx, n) == false) { - dom_node_unref(n); - return 0; - } + if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); + return 0; } + dom_node_unref(n); return 1; %} |