Handle an Arkose script load failure while its payload loads

What does this MR do and why?

Fixes an unhandled promise rejection in the Arkose Labs initialization that occurs when the script fails to load before the payload request finishes. The function initArkoseLabsChallenge starts two async operations: a payload request and a script injection. When the script fails first, the rejection fires with no handler at that moment, and the browser reports an unhandled promise rejection. The reported value is a DOM Event, which appears as an empty console error attributed to the file.

This fix awaits both promises together with Promise.all. Both handlers attach immediately. Callers' catch blocks still receive the script error and bypass or log as before. This eliminates the empty console error while keeping the normal error handling flow intact.

44 feature spec examples showed this empty console error because the Arkose script never loads in the test environment.

References

Screenshots or screen recordings

Not applicable. No UI change.

How to set up and validate locally

  1. Run yarn jest ee/spec/frontend/arkose_labs to verify the new Jest example passes: with the payload request pending, a script failure rejects the returned promise.
  2. In a GDK with Arkose configured for sign up, open the browser devtools network panel and block client-api.arkoselabs.com.
  3. Open the sign up page with the console open.
  4. On master an empty console error attributed to init_arkose_labs.js appears next to the [gitlab] ArkoseLabs initialization error log line. On this branch only the logged initialization error remains.

MR acceptance checklist

This MR was evaluated against the acceptance checklist.

Merge request reports

Loading
Loading