BL-697: Improve handling of JavaScript errors

Probably this is code you moved unchanged, but it seems unnecessary to use ifdef for a group of lines that is all-comment.