diff options
-rw-r--r-- | Makefile.sources.javascript | 1 | ||||
-rw-r--r-- | javascript/jsapi/binding.h | 5 | ||||
-rw-r--r-- | javascript/jsapi/node.bnd | 34 | ||||
-rw-r--r-- | javascript/jsapi/window.bnd | 5 |
4 files changed, 45 insertions, 0 deletions
diff --git a/Makefile.sources.javascript b/Makefile.sources.javascript index eff20524d..2a33565a6 100644 --- a/Makefile.sources.javascript +++ b/Makefile.sources.javascript @@ -20,6 +20,7 @@ JSAPI_BINDING_location := javascript/jsapi/location.bnd JSAPI_BINDING_htmlcollection := javascript/jsapi/htmlcollection.bnd JSAPI_BINDING_nodelist := javascript/jsapi/nodelist.bnd JSAPI_BINDING_text := javascript/jsapi/text.bnd +JSAPI_BINDING_node := javascript/jsapi/node.bnd # 1: input file # 2: output file diff --git a/javascript/jsapi/binding.h b/javascript/jsapi/binding.h index c6a460ccc..6400217c8 100644 --- a/javascript/jsapi/binding.h +++ b/javascript/jsapi/binding.h @@ -143,4 +143,9 @@ JSObject *jsapi_new_Text(JSContext *cx, dom_text *node, struct html_content *htmlc); +JSObject *jsapi_InitClass_Node(JSContext *cx, JSObject *parent); +JSObject *jsapi_new_Node(JSContext *cx, + JSObject *prototype, + JSObject *parent); + #endif diff --git a/javascript/jsapi/node.bnd b/javascript/jsapi/node.bnd new file mode 100644 index 000000000..bcf0ef7b3 --- /dev/null +++ b/javascript/jsapi/node.bnd @@ -0,0 +1,34 @@ +/* Binding to generate Node interface + * + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * Released under the terms of the MIT License, + * http://www.opensource.org/licenses/mit-license + */ + +webidlfile "dom.idl"; + +hdrcomment "Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>"; +hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; +hdrcomment "Released under the terms of the MIT License,"; +hdrcomment " http://www.opensource.org/licenses/mit-license"; + +preamble %{ + +#include <dom/dom.h> + +#include "utils/config.h" +#include "utils/log.h" + +#include "javascript/jsapi.h" +#include "javascript/jsapi/binding.h" + +%} + +binding node { + type js_libdom; /* the binding type */ + + interface Node; /* Web IDL interface to generate */ +} diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 45541faec..767b94f1b 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -135,6 +135,11 @@ api init %{ return NULL; } + user_proto = jsapi_InitClass_Node(cx, prototype); + if (user_proto == NULL) { + return NULL; + } + %} api new %{ |