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
- Part of section D of #628901 (console errors in feature specs)
- Console check and baseline allowlist MR that surfaced it: !255207 (closed)
- Reveal pipeline job showing the error: https://gitlab.com/gitlab-org/gitlab/-/jobs/16462296375
Screenshots or screen recordings
Not applicable. No UI change.
How to set up and validate locally
- Run
yarn jest ee/spec/frontend/arkose_labsto verify the new Jest example passes: with the payload request pending, a script failure rejects the returned promise. - In a GDK with Arkose configured for sign up, open the browser devtools network panel and block
client-api.arkoselabs.com. - Open the sign up page with the console open.
- On master an empty console error attributed to
init_arkose_labs.jsappears next to the[gitlab] ArkoseLabs initialization errorlog line. On this branch only the logged initialization error remains.
MR acceptance checklist
This MR was evaluated against the acceptance checklist.