JavaScript: fix parsing of files starting with a shebang

Closes #1016.