Build environment: macOS 26.5.2
Moddable SDK version:
- Installed via jsvu, so there is no SDK source tree /
git describe.
- Engine reports:
XS 17.9.1, slot 32 bytes, ID 4 bytes
Target device: desktop (host xs)
Description
decodeURI throws when its argument is omitted. The same behavior occurs with decodeURIComponent, encodeURI, and encodeURIComponent.
An omitted argument supplies undefined. Each algorithm applies ToString to its argument, so undefined becomes the String "undefined". All four functions should therefore return "undefined" without throwing.
Steps to Reproduce
$ xst -e "print(JSON.stringify(decodeURI()))"
SyntaxError: no URI parameter (in decodeURI)
Expected behavior
The String "undefined" is returned without an exception.
For comparison, V8 (15.3.27):
$ v8 -e "print(JSON.stringify(decodeURI()))"
"undefined"
Other information
XS already produces the expected result when undefined is passed explicitly:
$ xst -e "print(JSON.stringify(decodeURI(undefined)))"
"undefined"
Build environment: macOS 26.5.2
Moddable SDK version:
git describe.XS 17.9.1, slot 32 bytes, ID 4 bytesTarget device: desktop (host
xs)Description
decodeURIthrows when its argument is omitted. The same behavior occurs withdecodeURIComponent,encodeURI, andencodeURIComponent.An omitted argument supplies
undefined. Each algorithm appliesToStringto its argument, soundefinedbecomes the String"undefined". All four functions should therefore return"undefined"without throwing.Steps to Reproduce
$ xst -e "print(JSON.stringify(decodeURI()))" SyntaxError: no URI parameter (in decodeURI)Expected behavior
The String
"undefined"is returned without an exception.For comparison, V8 (15.3.27):
Other information
XS already produces the expected result when
undefinedis passed explicitly: