1
0
mirror of https://github.com/netsurf-browser/netsurf synced 2024-12-28 23:09:43 +03:00

Revert "The node acessors should return javacript null not an error"

This reverts commit 0645bc7570.
This commit is contained in:
Daniel Silverstone 2015-10-21 18:30:36 +02:00
parent 0645bc7570
commit 0ddb60d82a

View File

@ -132,18 +132,14 @@ getter Node::firstChild()
dom_exception exc; dom_exception exc;
dom_node *n; dom_node *n;
exc = dom_node_get_first_child(priv->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; return 0;
} }
if (n == NULL) {
duk_push_null(ctx);
} else {
if (dukky_push_node(ctx, n) == false) { if (dukky_push_node(ctx, n) == false) {
dom_node_unref(n); dom_node_unref(n);
return 0; return 0;
} }
dom_node_unref(n); dom_node_unref(n);
}
return 1; return 1;
%} %}
@ -152,18 +148,14 @@ getter Node::lastChild()
dom_exception exc; dom_exception exc;
dom_node *n; dom_node *n;
exc = dom_node_get_last_child(priv->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; return 0;
} }
if (n == NULL) {
duk_push_null(ctx);
} else {
if (dukky_push_node(ctx, n) == false) { if (dukky_push_node(ctx, n) == false) {
dom_node_unref(n); dom_node_unref(n);
return 0; return 0;
} }
dom_node_unref(n); dom_node_unref(n);
}
return 1; return 1;
%} %}
@ -172,18 +164,14 @@ getter Node::previousSibling()
dom_exception exc; dom_exception exc;
dom_node *n; dom_node *n;
exc = dom_node_get_previous_sibling(priv->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; return 0;
} }
if (n == NULL) {
duk_push_null(ctx);
} else {
if (dukky_push_node(ctx, n) == false) { if (dukky_push_node(ctx, n) == false) {
dom_node_unref(n); dom_node_unref(n);
return 0; return 0;
} }
dom_node_unref(n); dom_node_unref(n);
}
return 1; return 1;
%} %}
@ -192,18 +180,14 @@ getter Node::nextSibling()
dom_exception exc; dom_exception exc;
dom_node *n; dom_node *n;
exc = dom_node_get_next_sibling(priv->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; return 0;
} }
if (n == NULL) {
duk_push_null(ctx);
} else {
if (dukky_push_node(ctx, n) == false) { if (dukky_push_node(ctx, n) == false) {
dom_node_unref(n); dom_node_unref(n);
return 0; return 0;
} }
dom_node_unref(n); dom_node_unref(n);
}
return 1; return 1;
%} %}