summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2019-08-04 11:11:35 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2019-08-04 11:11:35 +0100
commit90fe920e07c78e4f65f5df84498c570892e5e2c0 (patch)
tree626ab633d2ff3bf7fe6a0385fba128eec37ae90a /content
parenta0fbf56a1da97e74e7b5dc00a2d0643ed2b60639 (diff)
downloadnetsurf-90fe920e07c78e4f65f5df84498c570892e5e2c0.tar.gz
netsurf-90fe920e07c78e4f65f5df84498c570892e5e2c0.tar.bz2
Duktape element binding: Check dom_string_create for error.
Diffstat (limited to 'content')
-rw-r--r--content/handlers/javascript/duktape/Element.bnd6
1 files changed, 6 insertions, 0 deletions
diff --git a/content/handlers/javascript/duktape/Element.bnd b/content/handlers/javascript/duktape/Element.bnd
index 33fc0863e..6702342e1 100644
--- a/content/handlers/javascript/duktape/Element.bnd
+++ b/content/handlers/javascript/duktape/Element.bnd
@@ -283,6 +283,9 @@ method Element::getAttribute()
const char *s = duk_safe_to_lstring(ctx, 0, &slen);
exc = dom_string_create((const uint8_t *)s, slen, &attr_name);
duk_pop(ctx);
+ if (exc != DOM_NO_ERR) {
+ return 0;
+ }
exc = dom_element_get_attribute(priv->parent.node,
attr_name, &attr_value);
@@ -336,6 +339,9 @@ method Element::hasAttribute()
const char *s = duk_safe_to_lstring(ctx, 0, &slen);
exc = dom_string_create((const uint8_t *)s, slen, &attr_name);
duk_pop(ctx);
+ if (exc != DOM_NO_ERR) {
+ return 0;
+ }
exc = dom_element_has_attribute(priv->parent.node,
attr_name, &res);