diff options
author | Vincent Sanders <vince@kyllikki.org> | 2012-10-21 12:56:50 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2012-10-21 12:56:50 +0100 |
commit | d264e721abc7848ae4f82fbaae444245f0e1e2b9 (patch) | |
tree | 00255013bf0803c4badfa02313af5cdec4ff054d /test/data | |
parent | 903f328e2ea9405a0d351c828389cf0080670b6c (diff) | |
download | nsgenbind-d264e721abc7848ae4f82fbaae444245f0e1e2b9.tar.gz nsgenbind-d264e721abc7848ae4f82fbaae444245f0e1e2b9.tar.bz2 |
add includes in binding files to allow binding definitions to be split up
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/bindings/document.bnd | 16 | ||||
-rw-r--r-- | test/data/bindings/htmldocument.bnd | 22 |
2 files changed, 23 insertions, 15 deletions
diff --git a/test/data/bindings/document.bnd b/test/data/bindings/document.bnd new file mode 100644 index 0000000..54268e2 --- /dev/null +++ b/test/data/bindings/document.bnd @@ -0,0 +1,16 @@ +/* test binding for document - must be included */ + +webidlfile "eventtarget.idl"; +webidlfile "node.idl"; +webidlfile "document.idl"; + +operation getElementById %{ + dom_string *elementId_dom; + dom_element *element; + + dom_string_create((unsigned char*)elementId, elementId_len, &elementId_dom); + + dom_document_get_element_by_id(private->node, elementId_dom, &element); + + jsretval = OBJECT_TO_JSVAL(jsapi_new_element(cx, JS_GetGlobalObject(cx), private->htmlc, element)); +%} diff --git a/test/data/bindings/htmldocument.bnd b/test/data/bindings/htmldocument.bnd index 9b47433..310fc29 100644 --- a/test/data/bindings/htmldocument.bnd +++ b/test/data/bindings/htmldocument.bnd @@ -1,8 +1,7 @@ /* test binding to generate htmldocument */ -webidlfile "eventtarget.idl"; -webidlfile "node.idl"; -webidlfile "document.idl"; +#include "document.bnd" + webidlfile "htmldocument.idl"; hdrcomment "Part of NetSurf Project"; @@ -21,22 +20,15 @@ preamble %{ #include "javascript/jsapi.h" - %} operation write %{ + LOG(("content %p parser %p writing %s", + private->htmlc, private->htmlc->parser, text)); - if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt)) { - return JS_FALSE; - } - - JSString_to_char(u16_txt, txt, length); - - LOG(("content %p parser %p writing %s", - document->htmlc, document->htmlc->parser, txt)); - if (document->htmlc->parser != NULL) { - dom_hubbub_parser_insert_chunk(document->htmlc->parser, (uint8_t *)txt, length); - } + if (private->htmlc->parser != NULL) { + dom_hubbub_parser_insert_chunk(private->htmlc->parser, (uint8_t *)text, text_len); + } %} binding document { |