javascript: Stop using longjmp() and friends

Part of #90.