diff options
-rw-r--r-- | javascript/Makefile | 5 | ||||
-rw-r--r-- | javascript/duktape/Document.bnd | 1 | ||||
-rw-r--r-- | javascript/duktape/HTMLCollection.bnd | 24 | ||||
-rw-r--r-- | javascript/duktape/Node.bnd | 3 | ||||
-rw-r--r-- | javascript/duktape/NodeList.bnd | 54 | ||||
-rw-r--r-- | javascript/duktape/Window.bnd | 19 | ||||
-rw-r--r-- | javascript/duktape/character_data.c | 50 | ||||
-rw-r--r-- | javascript/duktape/comment.c | 50 | ||||
-rw-r--r-- | javascript/duktape/document.c | 248 | ||||
-rw-r--r-- | javascript/duktape/element.c | 220 | ||||
-rw-r--r-- | javascript/duktape/event_target.c | 44 | ||||
-rw-r--r-- | javascript/duktape/html_br_element.c | 50 | ||||
-rw-r--r-- | javascript/duktape/html_collection.c | 48 | ||||
-rw-r--r-- | javascript/duktape/html_element.c | 50 | ||||
-rw-r--r-- | javascript/duktape/html_unknown_element.c | 50 | ||||
-rw-r--r-- | javascript/duktape/netsurf.bnd | 11 | ||||
-rw-r--r-- | javascript/duktape/node.c | 91 | ||||
-rw-r--r-- | javascript/duktape/node_list.c | 82 | ||||
-rw-r--r-- | javascript/duktape/private.h | 71 | ||||
-rw-r--r-- | javascript/duktape/prototypes.h | 19 | ||||
-rw-r--r-- | javascript/duktape/text.c | 50 | ||||
-rw-r--r-- | javascript/duktape/window.c | 90 |
22 files changed, 99 insertions, 1231 deletions
diff --git a/javascript/Makefile b/javascript/Makefile index 15aa78965..078920d33 100644 --- a/javascript/Makefile +++ b/javascript/Makefile @@ -82,11 +82,6 @@ S_JSAPI_BINDING:=$(addprefix $(OBJROOT)/duktape/,$(NSGENBIND_SOURCES)) $(S_JSAPI_BINDING): $(BINDINGS) -#S_DUKKY := event_target.c window.c node.c document.c \ -# element.c html_element.c html_unknown_element.c \ -# character_data.c text.c comment.c html_collection.c node_list.c \ -# html_br_element.c - S_JAVASCRIPT += dukky.c content.c fetcher.c duktape/duktape.c else diff --git a/javascript/duktape/Document.bnd b/javascript/duktape/Document.bnd index 03a29e7f0..b99e43810 100644 --- a/javascript/duktape/Document.bnd +++ b/javascript/duktape/Document.bnd @@ -31,6 +31,7 @@ method Document::write() if (err == DOM_NO_ERR && htmlc->parser != NULL) { dom_hubbub_parser_insert_chunk(htmlc->parser, (uint8_t *)text, text_len); } + return 0; %} method Document::createTextNode() diff --git a/javascript/duktape/HTMLCollection.bnd b/javascript/duktape/HTMLCollection.bnd new file mode 100644 index 000000000..08a162d35 --- /dev/null +++ b/javascript/duktape/HTMLCollection.bnd @@ -0,0 +1,24 @@ +/* HTMLCollection binding for browser using duktape and libdom + * + * Copyright 2015 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 + */ + +class HTMLCollection { + private "struct dom_html_collection *" coll; +} + +init HTMLCollection("struct dom_html_collection *" coll) +%{ + priv->coll = coll; + dom_html_collection_ref(coll); +%} + +fini HTMLCollection() +%{ + dom_html_collection_unref(priv->coll); +%} diff --git a/javascript/duktape/Node.bnd b/javascript/duktape/Node.bnd index dcb02aa80..70a981d86 100644 --- a/javascript/duktape/Node.bnd +++ b/javascript/duktape/Node.bnd @@ -35,6 +35,8 @@ method Node::appendChild() err = dom_node_append_child(priv->node, other->node, &spare); if (err != DOM_NO_ERR) return 0; dom_node_unref(spare); + + return 0; %} getter Node::textContent() @@ -52,4 +54,5 @@ getter Node::textContent() dom_string_unref(content); return 1; } + return 0; %} diff --git a/javascript/duktape/NodeList.bnd b/javascript/duktape/NodeList.bnd new file mode 100644 index 000000000..e085b6cda --- /dev/null +++ b/javascript/duktape/NodeList.bnd @@ -0,0 +1,54 @@ +/* NodeList binding for browser using duktape and libdom + * + * Copyright 2015 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 + */ + +class NodeList { + private "struct dom_nodelist *" nodes; +} + +init NodeList("struct dom_nodelist *" nodes) +%{ + priv->nodes = nodes; + dom_nodelist_ref(nodes); +%} + +fini NodeList() +%{ + dom_nodelist_unref(priv->nodes); +%} + +getter NodeList::length() +%{ + dom_exception err; + uint32_t len; + + err = dom_nodelist_get_length(priv->nodes, &len); + + if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ + + duk_push_uint(ctx, (duk_uint_t)len); + + return 1; +%} + +method NodeList::item() +%{ + unsigned long i = duk_to_uint(ctx, 0); + dom_exception err; + dom_node *node; + + err = dom_nodelist_item(priv->nodes, i, &node); + + if (err != DOM_NO_ERR) return 0; /* coerced to undefied */ + + dukky_push_node(ctx, node); + dom_node_unref(node); + + return 1; +%} diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index b2b821c3b..2223ae88d 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -29,7 +29,12 @@ init Window("struct browser_window *" win, "struct html_content *" htmlc) LOG("URL is %s", nsurl_access(browser_window_get_url(priv->win))); %} - +prototype Window() +%{ + /* steal undefined */ + duk_get_global_string(ctx, "undefined"); + duk_put_prop_string(ctx, 0, "undefined"); +%} getter Window::document() %{ @@ -39,21 +44,9 @@ getter Window::document() return 1; %} -setter Window::document() -%{ - LOG("BWUAhAHAHAHAHA FUCK OFF"); -%} getter Window::document() %{ duk_dup(ctx, 0); return 1; %} - -/* prototype needs: -#define STEAL_THING(X) \ - duk_get_global_string(ctx, #X); \ - duk_put_prop_string(ctx, 0, #X) - -STEAL_THING(undefined); - */ diff --git a/javascript/duktape/character_data.c b/javascript/duktape/character_data.c deleted file mode 100644 index 608c6554d..000000000 --- a/javascript/duktape/character_data.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(character_data, struct dom_node_character_data *character_data) -{ - DUKKY_FUNC_T(node, __init)(ctx, &priv->parent, (struct dom_node *)character_data); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(character_data) -{ - /* do any character_data finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(node, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(character_data, __constructor) -{ - DUKKY_CREATE_PRIVATE(character_data); - DUKKY_FUNC_T(character_data, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(character_data, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(character_data, 0); - DUKKY_FUNC_T(character_data, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(character_data, __proto) -{ - /* Populate character_data's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(NODE); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, character_data); - DUKKY_SET_CONSTRUCTOR(0, character_data, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/comment.c b/javascript/duktape/comment.c deleted file mode 100644 index 8fbf79f55..000000000 --- a/javascript/duktape/comment.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(comment, struct dom_node_comment *comment) -{ - DUKKY_FUNC_T(character_data, __init)(ctx, &priv->parent, (struct dom_node_character_data *)comment); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(comment) -{ - /* do any comment finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(character_data, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(comment, __constructor) -{ - DUKKY_CREATE_PRIVATE(comment); - DUKKY_FUNC_T(comment, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(comment, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(comment, 0); - DUKKY_FUNC_T(comment, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(comment, __proto) -{ - /* Populate comment's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(CHARACTERDATA); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, comment); - DUKKY_SET_CONSTRUCTOR(0, comment, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/document.c b/javascript/duktape/document.c deleted file mode 100644 index f09629ac6..000000000 --- a/javascript/duktape/document.c +++ /dev/null @@ -1,248 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" -#include "utils/corestrings.h" -#include "render/html_internal.h" -#include "utils/libdom.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(document, struct dom_document *document) -{ - DUKKY_FUNC_T(node, __init)(ctx, &priv->parent, (struct dom_node *)document); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(document) -{ - /* do any document finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(node, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(document, __constructor) -{ - DUKKY_CREATE_PRIVATE(document); - DUKKY_FUNC_T(document, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(document, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(document, 0); - DUKKY_FUNC_T(document, __fini)(ctx, priv); - free(priv); - return 0; -} - -static DUKKY_FUNC(document, write) -{ - DUKKY_GET_METHOD_PRIVATE(document); - struct html_content *htmlc; - duk_size_t text_len; - const char *text = duk_safe_to_lstring(ctx, 0, &text_len); - LOG("Writing %*s", (int)text_len, text); - dom_exception err; - err = dom_node_get_user_data(priv->parent.node, - corestring_dom___ns_key_html_content_data, - &htmlc); - if (err == DOM_NO_ERR && htmlc->parser != NULL) { - dom_hubbub_parser_insert_chunk(htmlc->parser, (uint8_t *)text, text_len); - } - return 0; -} - -static DUKKY_FUNC(document, createTextNode) -{ - DUKKY_GET_METHOD_PRIVATE(document); - dom_node *newnode; - dom_exception err; - duk_size_t text_len; - const char *text = duk_safe_to_lstring(ctx, 0, &text_len); - dom_string *text_str; - - err = dom_string_create((const uint8_t*)text, text_len, &text_str); - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - err = dom_document_create_text_node(priv->parent.node, - text_str, - &newnode); - if (err != DOM_NO_ERR) { - dom_string_unref(text_str); - return 0; /* coerced to undefined */ - } - - dom_string_unref(text_str); - - dukky_push_node(ctx, newnode); - - dom_node_unref(newnode); - - return 1; -} - -static DUKKY_FUNC(document, createElement) -{ - DUKKY_GET_METHOD_PRIVATE(document); - dom_node *newnode; - dom_exception err; - duk_size_t text_len; - const char *text = duk_safe_to_lstring(ctx, 0, &text_len); - dom_string *text_str; - - err = dom_string_create((const uint8_t*)text, text_len, &text_str); - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - err = dom_document_create_element_ns(priv->parent.node, - corestring_dom_html_namespace, - text_str, - &newnode); - if (err != DOM_NO_ERR) { - dom_string_unref(text_str); - return 0; /* coerced to undefined */ - } - - dom_string_unref(text_str); - - dukky_push_node(ctx, newnode); - - dom_node_unref(newnode); - - return 1; -} - -static DUKKY_GETTER(document, head) -{ - DUKKY_GET_METHOD_PRIVATE(document); - struct dom_nodelist *nodes; - struct dom_node *retnode; - dom_exception err; - err = dom_document_get_elements_by_tag_name(priv->parent.node, - corestring_dom_HEAD, - &nodes); - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - err = dom_nodelist_item(nodes, 0, &retnode); - - if (err != DOM_NO_ERR) { - dom_nodelist_unref(nodes); - return 0; /* coerced to undefined */ - } - - dom_nodelist_unref(nodes); - - if (retnode == NULL) return 0; /* coerced to undefined */ - - dukky_push_node(ctx, retnode); - - dom_node_unref(retnode); - - return 1; -} - -static DUKKY_GETTER(document, body) -{ - DUKKY_GET_METHOD_PRIVATE(document); - struct dom_nodelist *nodes; - struct dom_node *retnode; - dom_exception err; - err = dom_document_get_elements_by_tag_name(priv->parent.node, - corestring_dom_BODY, - &nodes); - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - err = dom_nodelist_item(nodes, 0, &retnode); - - if (err != DOM_NO_ERR) { - dom_nodelist_unref(nodes); - return 0; /* coerced to undefined */ - } - - dom_nodelist_unref(nodes); - - if (retnode == NULL) return 0; /* coerced to undefined */ - - dukky_push_node(ctx, retnode); - - dom_node_unref(retnode); - - return 1; -} - -static DUKKY_FUNC(document, getElementById) -{ - DUKKY_GET_METHOD_PRIVATE(document); - dom_string *elementId_dom; - dom_element *element; - dom_exception exc; - duk_size_t text_len; - const char *text = duk_safe_to_lstring(ctx, 0, &text_len); - - exc = dom_string_create((uint8_t*)text, text_len, &elementId_dom); - if (exc != DOM_NO_ERR) { - return 0; - } - - exc = dom_document_get_element_by_id(((node_private_t *)priv)->node, - elementId_dom, &element); - dom_string_unref(elementId_dom); - if (exc != DOM_NO_ERR) { - return 0; - } - - if (element != NULL) { - dukky_push_node(ctx, (dom_node *)element); - return 1; - } - - return 0; -} - -static DUKKY_FUNC(document, getElementsByTagName) -{ - DUKKY_GET_METHOD_PRIVATE(document); - dom_nodelist *nodes; - dom_exception err; - duk_size_t text_len; - const char *text = duk_safe_to_lstring(ctx, 0, &text_len); - dom_string *tag; - - err = dom_string_create((uint8_t*)text, text_len, &tag); - - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - err = dom_document_get_elements_by_tag_name(((node_private_t *)priv)->node, - tag, &nodes); - dom_string_unref(tag); - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - if (nodes == NULL) return 0; /* coerced to undefined */ - - duk_push_pointer(ctx, nodes); - dukky_create_object(ctx, PROTO_NAME(NODELIST), 1); - dom_nodelist_unref(nodes); - return 1; -} - -DUKKY_FUNC(document, __proto) -{ - /* Populate document's prototypical functionality */ - DUKKY_ADD_METHOD(document, write, 1); - DUKKY_ADD_METHOD(document, createTextNode, 1); - DUKKY_ADD_METHOD(document, createElement, 1); - DUKKY_ADD_METHOD(document, getElementById, 1); - DUKKY_ADD_METHOD(document, getElementsByTagName, 1); - DUKKY_POPULATE_READONLY_PROPERTY(document, body); - DUKKY_POPULATE_READONLY_PROPERTY(document, head); - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(NODE); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, document); - DUKKY_SET_CONSTRUCTOR(0, document, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/element.c b/javascript/duktape/element.c deleted file mode 100644 index b86e940f2..000000000 --- a/javascript/duktape/element.c +++ /dev/null @@ -1,220 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(element, struct dom_element *element) -{ - DUKKY_FUNC_T(node, __init)(ctx, &priv->parent, (struct dom_node *)element); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(element) -{ - /* do any element finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(node, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(element, __constructor) -{ - DUKKY_CREATE_PRIVATE(element); - DUKKY_FUNC_T(element, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(element, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(element, 0); - DUKKY_FUNC_T(element, __fini)(ctx, priv); - free(priv); - return 0; -} - -static DUKKY_GETTER(element, firstElementChild) -{ - DUKKY_GET_METHOD_PRIVATE(element); - dom_node *element; - dom_exception exc; - dom_node_type node_type; - dom_node *next_node; - - exc = dom_node_get_first_child(((node_private_t*)priv)->node, &element); - if (exc != DOM_NO_ERR) { - return 0; - } - - while (element != NULL) { - exc = dom_node_get_node_type(element, &node_type); - if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { - /* found it */ - dukky_push_node(ctx, (dom_node *)element); - dom_node_unref(element); - return 1; - } - - exc = dom_node_get_next_sibling(element, &next_node); - dom_node_unref(element); - if (exc == DOM_NO_ERR) { - element = next_node; - } else { - element = NULL; - } - } - return 0; -} - -static DUKKY_GETTER(element, lastElementChild) -{ - DUKKY_GET_METHOD_PRIVATE(element); - dom_node *element; - dom_exception exc; - dom_node_type node_type; - dom_node *next_node; - - exc = dom_node_get_last_child(((node_private_t*)priv)->node, &element); - if (exc != DOM_NO_ERR) { - return 0; - } - - while (element != NULL) { - exc = dom_node_get_node_type(element, &node_type); - if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { - /* found it */ - dukky_push_node(ctx, (dom_node *)element); - dom_node_unref(element); - return 1; - } - - exc = dom_node_get_previous_sibling(element, &next_node); - dom_node_unref(element); - if (exc == DOM_NO_ERR) { - element = next_node; - } else { - element = NULL; - } - } - return 0; -} - -static DUKKY_GETTER(element, previousElementSibling) -{ - DUKKY_GET_METHOD_PRIVATE(element); - dom_node *element; - dom_exception exc; - dom_node_type node_type; - dom_node *sib_node; - - exc = dom_node_get_previous_sibling(((node_private_t *)priv)->node, &element); - if (exc != DOM_NO_ERR) { - return 0; - } - - while (element != NULL) { - exc = dom_node_get_node_type(element, &node_type); - if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { - /* found it */ - dukky_push_node(ctx, (dom_node *)element); - dom_node_unref(element); - return 1; - } - - exc = dom_node_get_previous_sibling(element, &sib_node); - dom_node_unref(element); - if (exc == DOM_NO_ERR) { - element = sib_node; - } else { - element = NULL; - } - } - return 0; -} - -static DUKKY_GETTER(element, nextElementSibling) -{ - DUKKY_GET_METHOD_PRIVATE(element); - dom_node *element; - dom_exception exc; - dom_node_type node_type; - dom_node *sib_node; - - exc = dom_node_get_next_sibling(((node_private_t *)priv)->node, &element); - if (exc != DOM_NO_ERR) { - return 0; - } - - while (element != NULL) { - exc = dom_node_get_node_type(element, &node_type); - if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { - /* found it */ - dukky_push_node(ctx, (dom_node *)element); - dom_node_unref(element); - return 1; - } - - exc = dom_node_get_next_sibling(element, &sib_node); - dom_node_unref(element); - if (exc == DOM_NO_ERR) { - element = sib_node; - } else { - element = NULL; - } - } - return 0; -} - -static DUKKY_GETTER(element, childElementCount) -{ - LOG("MOO"); - DUKKY_GET_METHOD_PRIVATE(element); - dom_node *element; - dom_exception exc; - dom_node_type node_type; - dom_node *next_node; - duk_uint_t jsret = 0; - - exc = dom_node_get_first_child(((node_private_t *)priv)->node, &element); - if (exc != DOM_NO_ERR) { - return 0; - } - - while (element != NULL) { - exc = dom_node_get_node_type(element, &node_type); - if ((exc == DOM_NO_ERR) && (node_type == DOM_ELEMENT_NODE)) { - jsret += 1; - } - - exc = dom_node_get_next_sibling(element, &next_node); - dom_node_unref(element); - if (exc == DOM_NO_ERR) { - element = next_node; - } else { - element = NULL; - } - } - LOG("I found %u of them", jsret); - duk_push_uint(ctx, jsret); - return 1; -} - -DUKKY_FUNC(element, __proto) -{ - /* Populate element's prototypical functionality */ - DUKKY_POPULATE_READONLY_PROPERTY(element, firstElementChild); - DUKKY_POPULATE_READONLY_PROPERTY(element, lastElementChild); - DUKKY_POPULATE_READONLY_PROPERTY(element, nextElementSibling); - DUKKY_POPULATE_READONLY_PROPERTY(element, previousElementSibling); - DUKKY_POPULATE_READONLY_PROPERTY(element, childElementCount); - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(NODE); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, element); - DUKKY_SET_CONSTRUCTOR(0, element, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/event_target.c b/javascript/duktape/event_target.c deleted file mode 100644 index 669d0fd4f..000000000 --- a/javascript/duktape/event_target.c +++ /dev/null @@ -1,44 +0,0 @@ -/* DO NOT USE, DODGY EXAMPLE FOR VINCE */ - -#include "utils/log.h" - -#include <dom/dom.h> - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(event_target) -{ - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(event_target) -{ - /* do any event_target finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); -} - -static DUKKY_FUNC(event_target, __constructor) -{ - DUKKY_CREATE_PRIVATE(event_target); - DUKKY_FUNC_T(event_target, __init)(ctx, priv); - return 1; -} - -static DUKKY_FUNC(event_target, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(event_target, 0); - DUKKY_FUNC_T(event_target, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(event_target, __proto) -{ - /* Populate event_target's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, event_target); - DUKKY_SET_CONSTRUCTOR(0, event_target, 0); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/html_br_element.c b/javascript/duktape/html_br_element.c deleted file mode 100644 index 6b5dd9e7d..000000000 --- a/javascript/duktape/html_br_element.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(html_br_element, struct dom_html_br_element *html_br_element) -{ - DUKKY_FUNC_T(html_element, __init)(ctx, &priv->parent, (struct dom_html_element *)html_br_element); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(html_br_element) -{ - /* do any html_br_element finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(html_element, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(html_br_element, __constructor) -{ - DUKKY_CREATE_PRIVATE(html_br_element); - DUKKY_FUNC_T(html_br_element, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(html_br_element, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(html_br_element, 0); - DUKKY_FUNC_T(html_br_element, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(html_br_element, __proto) -{ - /* Populate html_br_element's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(HTMLELEMENT); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, html_br_element); - DUKKY_SET_CONSTRUCTOR(0, html_br_element, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/html_collection.c b/javascript/duktape/html_collection.c deleted file mode 100644 index 835398a0e..000000000 --- a/javascript/duktape/html_collection.c +++ /dev/null @@ -1,48 +0,0 @@ -/* DO NOT USE, DODGY EXAMPLE FOR VINCE */ - -#include "utils/log.h" - -#include <dom/dom.h> - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(html_collection, struct dom_html_collection *coll) -{ - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); - priv->coll = coll; - dom_html_collection_ref(coll); -} - -DUKKY_FUNC_FINI(html_collection) -{ - /* do any html_collection finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - dom_html_collection_unref(priv->coll); -} - -static DUKKY_FUNC(html_collection, __constructor) -{ - DUKKY_CREATE_PRIVATE(html_collection); - DUKKY_FUNC_T(html_collection, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - return 1; -} - -static DUKKY_FUNC(html_collection, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(html_collection, 0); - DUKKY_FUNC_T(html_collection, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(html_collection, __proto) -{ - /* Populate html_collection's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, html_collection); - DUKKY_SET_CONSTRUCTOR(0, html_collection, 0); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/html_element.c b/javascript/duktape/html_element.c deleted file mode 100644 index 1b22f6788..000000000 --- a/javascript/duktape/html_element.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(html_element, struct dom_html_element *html_element) -{ - DUKKY_FUNC_T(element, __init)(ctx, &priv->parent, (struct dom_element *)html_element); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(html_element) -{ - /* do any html_element finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(element, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(html_element, __constructor) -{ - DUKKY_CREATE_PRIVATE(html_element); - DUKKY_FUNC_T(html_element, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(html_element, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(html_element, 0); - DUKKY_FUNC_T(html_element, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(html_element, __proto) -{ - /* Populate html_element's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(ELEMENT); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, html_element); - DUKKY_SET_CONSTRUCTOR(0, html_element, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/html_unknown_element.c b/javascript/duktape/html_unknown_element.c deleted file mode 100644 index 977450a02..000000000 --- a/javascript/duktape/html_unknown_element.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(html_unknown_element, struct dom_html_element *html_unknown_element) -{ - DUKKY_FUNC_T(html_element, __init)(ctx, &priv->parent, html_unknown_element); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(html_unknown_element) -{ - /* do any html_unknown_element finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(html_element, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(html_unknown_element, __constructor) -{ - DUKKY_CREATE_PRIVATE(html_unknown_element); - DUKKY_FUNC_T(html_unknown_element, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(html_unknown_element, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(html_unknown_element, 0); - DUKKY_FUNC_T(html_unknown_element, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(html_unknown_element, __proto) -{ - /* Populate html_unknown_element's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(HTMLELEMENT); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, html_unknown_element); - DUKKY_SET_CONSTRUCTOR(0, html_unknown_element, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/netsurf.bnd b/javascript/duktape/netsurf.bnd index 72f4b406d..935450a55 100644 --- a/javascript/duktape/netsurf.bnd +++ b/javascript/duktape/netsurf.bnd @@ -53,7 +53,9 @@ struct dom_html_br_element; #include "Window.bnd" #include "Document.bnd" #include "Node.bnd" +#include "NodeList.bnd" #include "Element.bnd" +#include "HTMLCollection.bnd" /* specialisations of html_element */ init HTMLUnknownElement("struct dom_html_element *" html_unknown_element::html_element); @@ -147,3 +149,12 @@ init CharacterData("struct dom_node_character_data *" character_data::node); init DocumentFragment("struct dom_document *" document::node); init DocumentType("struct dom_document *" document::node); +init PropertyNodeList("struct dom_nodelist *" nodes); +init RadioNodeList("struct dom_nodelist *" nodes); + +init HTMLAllCollection("struct dom_html_collection *" coll); +init HTMLFormControlsCollection("struct dom_html_collection *" coll); +init HTMLOptionsCollection("struct dom_html_collection *" coll); +init HTMLPropertiesCollection("struct dom_html_collection *" coll); + + diff --git a/javascript/duktape/node.c b/javascript/duktape/node.c deleted file mode 100644 index c81c1be10..000000000 --- a/javascript/duktape/node.c +++ /dev/null @@ -1,91 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(node, struct dom_node *node) -{ - DUKKY_FUNC_T(event_target, __init)(ctx, &priv->parent); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); - priv->node = dom_node_ref(node); -} - -DUKKY_FUNC_FINI(node) -{ - /* do any node finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - dom_node_unref(priv->node); - DUKKY_FUNC_T(event_target, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(node, __constructor) -{ - DUKKY_CREATE_PRIVATE(node); - DUKKY_FUNC_T(node, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(node, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(node, 0); - DUKKY_FUNC_T(node, __fini)(ctx, priv); - free(priv); - return 0; -} - -static DUKKY_FUNC(node, appendChild) -{ - DUKKY_GET_METHOD_PRIVATE(node); - - if (!dukky_instanceof(ctx, PROTO_NAME(NODE))) return 0; - - DUKKY_SAFE_GET_ANOTHER(other,node,0); - - dom_exception err; - dom_node *spare; - - err = dom_node_append_child(priv->node, other->node, &spare); - if (err != DOM_NO_ERR) return 0; - dom_node_unref(spare); - - return 0; -} - -static DUKKY_GETTER(node, textContent) -{ - DUKKY_GET_METHOD_PRIVATE(node); - dom_exception exc; - dom_string *content; - - exc = dom_node_get_text_content(priv->node, &content); - if (exc != DOM_NO_ERR) { - return 0; - } - - if (content != NULL) { - duk_push_lstring(ctx, dom_string_data(content), dom_string_length(content)); - dom_string_unref(content); - return 1; - } - - return 0; -} - -DUKKY_FUNC(node, __proto) -{ - /* Populate node's prototypical functionality */ - DUKKY_ADD_METHOD(node, appendChild, 1); - DUKKY_POPULATE_READONLY_PROPERTY(node, textContent); - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(EVENTTARGET); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, node); - DUKKY_SET_CONSTRUCTOR(0, node, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/node_list.c b/javascript/duktape/node_list.c deleted file mode 100644 index 5ee9ec600..000000000 --- a/javascript/duktape/node_list.c +++ /dev/null @@ -1,82 +0,0 @@ -/* DO NOT USE, DODGY EXAMPLE FOR VINCE */ - -#include "utils/log.h" - -#include <dom/dom.h> - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(node_list, struct dom_nodelist *nodes) -{ - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); - priv->nodes = nodes; - dom_nodelist_ref(nodes); -} - -DUKKY_FUNC_FINI(node_list) -{ - /* do any node_list finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - dom_nodelist_unref(priv->nodes); -} - -static DUKKY_FUNC(node_list, __constructor) -{ - DUKKY_CREATE_PRIVATE(node_list); - DUKKY_FUNC_T(node_list, __init)(ctx, priv, duk_get_pointer(ctx, 1)); - duk_pop(ctx); - return 1; -} - -static DUKKY_FUNC(node_list, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(node_list, 0); - DUKKY_FUNC_T(node_list, __fini)(ctx, priv); - free(priv); - return 0; -} - -static DUKKY_GETTER(node_list, length) -{ - DUKKY_GET_METHOD_PRIVATE(node_list); - dom_exception err; - uint32_t len; - - err = dom_nodelist_get_length(priv->nodes, &len); - - if (err != DOM_NO_ERR) return 0; /* coerced to undefined */ - - duk_push_uint(ctx, (duk_uint_t)len); - return 1; -} - -static DUKKY_FUNC(node_list, item) -{ - DUKKY_GET_METHOD_PRIVATE(node_list); - unsigned long i = duk_to_uint(ctx, 0); - dom_exception err; - dom_node *node; - - err = dom_nodelist_item(priv->nodes, i, &node); - - if (err != DOM_NO_ERR) return 0; /* coerced to undefied */ - - dukky_push_node(ctx, node); - dom_node_unref(node); - - return 1; -} - -/** TODO: ARRAY-LIKE behaviour missing */ - -DUKKY_FUNC(node_list, __proto) -{ - /* Populate node_list's prototypical functionality */ - DUKKY_POPULATE_READONLY_PROPERTY(node_list, length); - DUKKY_ADD_METHOD(node_list, item, 1); - /* Set this prototype's prototype (left-parent)*/ - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, node_list); - DUKKY_SET_CONSTRUCTOR(0, node_list, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/private.h b/javascript/duktape/private.h deleted file mode 100644 index da97031f3..000000000 --- a/javascript/duktape/private.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef DUKKY_PRIVATE_H -#define DUKKY_PRIVATE_H - -struct browser_window; -struct html_content; -struct dom_node; -struct dom_element; -struct dom_document; -struct dom_html_element; -struct dom_node_character_data; -struct dom_node_text; -struct dom_node_list; -struct dom_node_comment; -struct dom_html_collection; -struct dom_html_br_element; - -typedef struct { -} event_target_private_t; - -typedef struct { - event_target_private_t parent; - struct browser_window *win; - struct html_content *htmlc; -} window_private_t; - -typedef struct { - event_target_private_t parent; - struct dom_node *node; -} node_private_t; - -typedef struct { - node_private_t parent; -} character_data_private_t; - -typedef struct { - character_data_private_t parent; -} text_private_t; - -typedef struct { - character_data_private_t parent; -} comment_private_t; - -typedef struct { - node_private_t parent; -} element_private_t; - -typedef struct { - element_private_t parent; -} html_element_private_t; - -typedef struct { - html_element_private_t parent; -} html_unknown_element_private_t; - -typedef struct { - html_element_private_t parent; -} html_br_element_private_t; - -typedef struct { - node_private_t parent; -} document_private_t; - -typedef struct { - struct dom_html_collection *coll; -} html_collection_private_t; - -typedef struct { - struct dom_nodelist *nodes; -} node_list_private_t; - -#endif diff --git a/javascript/duktape/prototypes.h b/javascript/duktape/prototypes.h deleted file mode 100644 index 746f85cc5..000000000 --- a/javascript/duktape/prototypes.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef DUKTAPE_PROTOTYPES_H -#define DUKTAPE_PROTOTYPES_H - -DUKKY_DECLARE_INTERFACE(event_target); -DUKKY_DECLARE_INTERFACE(window, struct browser_window *, struct html_content *); -DUKKY_DECLARE_INTERFACE(node, struct dom_node *); -DUKKY_DECLARE_INTERFACE(character_data, struct dom_node_character_data *); -DUKKY_DECLARE_INTERFACE(text, struct dom_node_text *); -DUKKY_DECLARE_INTERFACE(comment, struct dom_node_comment *); -DUKKY_DECLARE_INTERFACE(document, struct dom_document *); -DUKKY_DECLARE_INTERFACE(element, struct dom_element *); -DUKKY_DECLARE_INTERFACE(html_element, struct dom_html_element *); -DUKKY_DECLARE_INTERFACE(html_unknown_element, struct dom_html_element *); -DUKKY_DECLARE_INTERFACE(html_br_element, struct dom_html_br_element *); -DUKKY_DECLARE_INTERFACE(html_collection, struct dom_html_collection *); -DUKKY_DECLARE_INTERFACE(node_list, struct dom_nodelist *); - -#endif - diff --git a/javascript/duktape/text.c b/javascript/duktape/text.c deleted file mode 100644 index 26457749d..000000000 --- a/javascript/duktape/text.c +++ /dev/null @@ -1,50 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -DUKKY_FUNC_INIT(text, struct dom_node_text *text) -{ - DUKKY_FUNC_T(character_data, __init)(ctx, &priv->parent, (struct dom_node_character_data *)text); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); -} - -DUKKY_FUNC_FINI(text) -{ - /* do any text finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(character_data, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(text, __constructor) -{ - DUKKY_CREATE_PRIVATE(text); - DUKKY_FUNC_T(text, __init)(ctx, priv, - duk_get_pointer(ctx, 1)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(text, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(text, 0); - DUKKY_FUNC_T(text, __fini)(ctx, priv); - free(priv); - return 0; -} - -DUKKY_FUNC(text, __proto) -{ - /* Populate text's prototypical functionality */ - - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(CHARACTERDATA); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, text); - DUKKY_SET_CONSTRUCTOR(0, text, 1); - return 1; /* The proto object */ -} diff --git a/javascript/duktape/window.c b/javascript/duktape/window.c deleted file mode 100644 index fd070aa2c..000000000 --- a/javascript/duktape/window.c +++ /dev/null @@ -1,90 +0,0 @@ -/* DO NOT USE, DODGY BIT FOR VINCE */ - -#include <dom/dom.h> - -#include "utils/log.h" - -#include "javascript/dukky.h" - -#include "desktop/browser.h" -#include "render/html.h" -#include "render/html_internal.h" -#include "utils/nsurl.h" - -DUKKY_FUNC_INIT(window, struct browser_window *win, - struct html_content *htmlc) -{ - DUKKY_FUNC_T(event_target, __init)(ctx, &priv->parent); - LOG("Initialise %p (priv=%p)", duk_get_heapptr(ctx, 0), priv); - /* element window */ - priv->win = win; - priv->htmlc = htmlc; - LOG("win=%p htmlc=%p", priv->win, priv->htmlc); - - LOG("URL is %s", nsurl_access(browser_window_get_url(priv->win))); - - /* populate window.window */ - duk_dup(ctx, 0); - duk_put_prop_string(ctx, 0, "window"); -} - -DUKKY_FUNC_FINI(window) -{ - /* do any window finalisation here, priv ptr exists */ - LOG("Finalise %p", duk_get_heapptr(ctx, 0)); - DUKKY_FUNC_T(event_target, __fini)(ctx, &priv->parent); -} - -static DUKKY_FUNC(window, __constructor) -{ - DUKKY_CREATE_PRIVATE(window); - DUKKY_FUNC_T(window, __init)(ctx, priv, - duk_get_pointer(ctx, 1), - duk_get_pointer(ctx, 2)); - duk_set_top(ctx, 1); - return 1; -} - -static DUKKY_FUNC(window, __destructor) -{ - DUKKY_SAFE_GET_PRIVATE(window, 0); - DUKKY_FUNC_T(window, __fini)(ctx, priv); - free(priv); - return 0; -} - -static DUKKY_GETTER(window,document) -{ - DUKKY_GET_METHOD_PRIVATE(window); - LOG("priv=%p", priv); - dom_document *doc = priv->htmlc->document; - dukky_push_node(ctx, (struct dom_node *)doc); - return 1; -} - -static DUKKY_SETTER(window,document) -{ - LOG("BWUAhAHAHAHAHA FUCK OFF"); - return 0; -} - -#define STEAL_THING(X) \ - duk_get_global_string(ctx, #X); \ - duk_put_prop_string(ctx, 0, #X) - -DUKKY_FUNC(window, __proto) -{ - STEAL_THING(undefined); - /* Populate window's prototypical functionality */ - DUKKY_POPULATE_FULL_PROPERTY(window, document); - /* Exposed prototypes */ - DUKKY_GET_PROTOTYPE(NODE); - duk_put_prop_string(ctx, 0, "Node"); - /* Set this prototype's prototype (left-parent)*/ - DUKKY_GET_PROTOTYPE(EVENTTARGET); - duk_set_prototype(ctx, 0); - /* And the initialiser/finalizer */ - DUKKY_SET_DESTRUCTOR(0, window); - DUKKY_SET_CONSTRUCTOR(0, window, 2); - return 1; /* The proto object */ -} |