diff --git a/exec/tests/global/except.js b/exec/tests/global/except.js index 68a45188f583e1efced8c8eef9d51994292ecc40..90d59f99f57302a543379512c2d591f4807aa28d 100644 --- a/exec/tests/global/except.js +++ b/exec/tests/global/except.js @@ -2,7 +2,7 @@ // Value (e.g. 0, 1) is number of non-null/undefined args required var func_list = { - 'ascii': 1, + 'ascii': 0, 'ascii_str': 0, 'alert': 0, 'backslash': 0, diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c index bd5da24ea830afd7595481ed541a942c0915f869..894dd7fd051d5b6bd4dacd8ad3e9b09d0183f81b 100644 --- a/src/sbbs3/js_global.c +++ b/src/sbbs3/js_global.c @@ -1045,8 +1045,11 @@ js_ascii(JSContext *cx, uintN argc, jsval *arglist) if (js_argcIsInsufficient(cx, argc, 1)) return JS_FALSE; - if (js_argvIsNullOrVoid(cx, argv, 0)) - return JS_FALSE; + + if (JSVAL_NULL_OR_VOID(argv[0])) { + JS_SET_RVAL(cx, arglist, argv[0]); + return JS_TRUE; + } if (JSVAL_IS_STRING(argv[0])) { /* string to ascii-int */ p = JS_GetStringCharsZ(cx, JSVAL_TO_STRING(argv[0])); @@ -4991,7 +4994,7 @@ static jsSyncMethodSpec js_global_functions[] = { , JSDOCSTR("Return ASCII control character representing character value passed - Example: <tt>ctrl('C')</tt> returns string containing the single character string: <tt>'\\3'</tt>") , 311}, {"ascii", js_ascii, 1, JSTYPE_UNDEF, JSDOCSTR("[<i>string</i> text] or [<i>number</i> value]") - , JSDOCSTR("Convert single character to numeric ASCII value or vice-versa (returns number OR string)") + , JSDOCSTR("Convert single character to numeric ASCII value or vice-versa, returns number OR string, or <tt>null</tt> or <tt>undefined</tt> if passed those values") , 310}, {"ascii_str", js_ascii_str, 1, JSTYPE_STRING, JSDOCSTR("text") , JSDOCSTR("Convert extended-ASCII (CP437) characters in text string to plain US-ASCII equivalent, returns modified string or <tt>null</tt> or <tt>undefined</tt> if passed those values")