Gitweb links:
...log
http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/e0e92e4a68a87ebba...
...commit
http://git.netsurf-browser.org/nsgenjsbind.git/commit/e0e92e4a68a87ebba05...
...tree
http://git.netsurf-browser.org/nsgenjsbind.git/tree/e0e92e4a68a87ebba0583...
The branch, master has been updated
via e0e92e4a68a87ebba0583f2a26514f619cc08a30 (commit)
from b29ff13b599730bf3eaec8f142e584f23e78c1fb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/e0e92e4a68a87eb...
commit e0e92e4a68a87ebba0583f2a26514f619cc08a30
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
ensure nullable type extension on strings is obeyed
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 87cbc10..6bb695a 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -437,6 +437,7 @@ static int output_return(struct binding *binding,
{
struct webidl_node *type_node = NULL;
struct webidl_node *type_base = NULL;
+ struct webidl_node *type_nullable = NULL;
enum webidl_type webidl_arg_type;
type_node = webidl_node_find_type(webidl_node_getnode(node),
@@ -449,6 +450,10 @@ static int output_return(struct binding *binding,
webidl_arg_type = webidl_node_getint(type_base);
+ type_nullable = webidl_node_find_type(webidl_node_getnode(type_node),
+ NULL,
+ WEBIDL_NODE_TYPE_TYPE_NULLABLE);
+
switch (webidl_arg_type) {
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
@@ -502,6 +507,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_STRING:
/* JSString * */
+ if (type_nullable == NULL) {
+ /* entry is not nullable ensure it is set to a string */
+ fprintf(binding->outfile,
+ "\tif (%s == NULL) {\n"
+ "\t\t%s = JS_NewStringCopyN(cx, NULL, 0);\n"
+ "\t}\n",
+ ident, ident);
+ }
fprintf(binding->outfile,
"\tJSAPI_PROP_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom-property.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 87cbc10..6bb695a 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -437,6 +437,7 @@ static int output_return(struct binding *binding,
{
struct webidl_node *type_node = NULL;
struct webidl_node *type_base = NULL;
+ struct webidl_node *type_nullable = NULL;
enum webidl_type webidl_arg_type;
type_node = webidl_node_find_type(webidl_node_getnode(node),
@@ -449,6 +450,10 @@ static int output_return(struct binding *binding,
webidl_arg_type = webidl_node_getint(type_base);
+ type_nullable = webidl_node_find_type(webidl_node_getnode(type_node),
+ NULL,
+ WEBIDL_NODE_TYPE_TYPE_NULLABLE);
+
switch (webidl_arg_type) {
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
@@ -502,6 +507,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_STRING:
/* JSString * */
+ if (type_nullable == NULL) {
+ /* entry is not nullable ensure it is set to a string */
+ fprintf(binding->outfile,
+ "\tif (%s == NULL) {\n"
+ "\t\t%s = JS_NewStringCopyN(cx, NULL, 0);\n"
+ "\t}\n",
+ ident, ident);
+ }
fprintf(binding->outfile,
"\tJSAPI_PROP_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
--
NetSurf Generator for JavaScript bindings