From 5b0ac4502fd4407d51c165e0ea4ef814b3253fa9 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 7 Sep 2015 11:28:08 +0100 Subject: 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. --- src/duk-libdom-interface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/duk-libdom-interface.c') 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: -- cgit v1.2.3