diff options
Diffstat (limited to 'content/handlers/javascript/duktape/Document.bnd')
-rw-r--r-- | content/handlers/javascript/duktape/Document.bnd | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/content/handlers/javascript/duktape/Document.bnd b/content/handlers/javascript/duktape/Document.bnd index cc8a3a9c1..d27591759 100644 --- a/content/handlers/javascript/duktape/Document.bnd +++ b/content/handlers/javascript/duktape/Document.bnd @@ -18,6 +18,7 @@ prologue Document() #include "content/urldb.h" #define HANDLER_MAGIC MAGIC(HANDLER_MAP) +#define LIST_PROXY_MAGIC MAGIC(LIST_PROXY) %} @@ -344,10 +345,18 @@ method Document::getElementsByTagName() if (nodes == NULL) return 0; /* coerced to undefined */ + duk_get_global_string(ctx, LIST_PROXY_MAGIC); + duk_push_pointer(ctx, nodes); dukky_create_object(ctx, PROTO_NAME(NODELIST), 1); dom_nodelist_unref(nodes); - return 1; + + if (dukky_pcall(ctx, 1, false) != 0) { + NSLOG(dukky, DEBUG, "Unable to construct nodelist?"); + return 0; /* coerced to undefined */ + } + + return 1; /* The Proxy(NodeList) wrapper */ %} getter Document::cookie() |