summaryrefslogtreecommitdiff
path: root/src/duk-libdom-interface.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-09-07 11:28:08 +0100
committerVincent Sanders <vince@kyllikki.org>2015-09-07 11:28:08 +0100
commit5b0ac4502fd4407d51c165e0ea4ef814b3253fa9 (patch)
tree64b1b252766c4f7ff768a1735ca1cb7a74c40fa2 /src/duk-libdom-interface.c
parent83956295f66576becbf5de8cef915cd0d54f409b (diff)
downloadnsgenbind-5b0ac4502fd4407d51c165e0ea4ef814b3253fa9.tar.gz
nsgenbind-5b0ac4502fd4407d51c165e0ea4ef814b3253fa9.tar.bz2
Cause string arguments to operations to be coerced.
It appears that string parameters to operations must be coerced from other types instead of throwing a type error to conform to expected behaviour.
Diffstat (limited to 'src/duk-libdom-interface.c')
-rw-r--r--src/duk-libdom-interface.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/duk-libdom-interface.c b/src/duk-libdom-interface.c
index aa44d38..ad40741 100644
--- a/src/duk-libdom-interface.c
+++ b/src/duk-libdom-interface.c
@@ -993,10 +993,11 @@ output_operation_argument_type_check(
switch (*argument_type) {
case WEBIDL_TYPE_STRING:
+ /* coerce values to string */
fprintf(outf,
"\t\tif (!duk_is_string(ctx, %d)) {\n"
- "\t\t\tduk_error(ctx, DUK_ERR_ERROR, %s_error_fmt_string_type, %d, \"%s\");\n"
- "\t\t}\n", argidx, DLPFX, argidx, argumente->name);
+ "\t\t\tduk_to_string(ctx, %d);\n"
+ "\t\t}\n", argidx, argidx);
break;
case WEBIDL_TYPE_BOOL: