jsapi-util: Fix build

C++ doesn't like goto. Use JSAutoRequest instead.