ecmascript: Try to convert duktape number to integer if possible

Fixes #2336
ecmascript: Fix bug in Showtime.pathEscape()

Bug resulted in an extra \x00 byte being appended to the result

Fixes #2328