Page MenuHomePhabricator

hCaptcha: Don't use performance.measure()
Closed, ResolvedPublic3 Estimated Story Points

Description

Summary

Per https://en.wikipedia.org/wiki/Wikipedia:Teahouse#[hCaptcha]_There_was_an_error_in_your_callback., performance.measure is causing errors in Firefox 102. No one else seems to be using performance.measure, so we should rework our code here to be compatible with older browsers.

The call is being done from ext.confirmEdit.hCaptcha/utils.js.

Acceptance criteria

  • Equivalent functionality is implemented for the current usage of performance.measure()

Event Timeline

For clarity we do not use the https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure feature so AFAICS it should be supported in Firefox 102. The error that was reported was that the entire performance.measure method is removed

Having looked into this further with @kostajh it seems that the return value of performance.measure was not in place until Firefox 103. Using performance.getEntriesByName has better backwards compatibility ( https://caniuse.com/?search=performance.getEntriesByName ).

hector.arroyo changed the task status from Open to In Progress.Feb 2 2026, 5:46 PM
hector.arroyo claimed this task.
hector.arroyo set the point value for this task to 3.

Change #1236269 had a related patch set uploaded (by Harroyo-wmf; author: Harroyo-wmf):

[mediawiki/extensions/ConfirmEdit@master] hcaptcha: Provide a fallback if performance.now() is not available

https://gerrit.wikimedia.org/r/1236269

hector.arroyo changed the point value for this task from 2 to 3.Feb 20 2026, 12:20 PM

Change #1236269 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hcaptcha: Provide a fallback if performance.now() is not available

https://gerrit.wikimedia.org/r/1236269

I've verified that using an old Firefox version (v102.0.1) to load hCaptcha in auth.wikimedia.org triggers this error (currently at 1.46.0-wmf.17 as per https://versions.toolforge.org/).
I'll check again once 1.46.0-wmf.18 (which contains this fix) is deployed.

image.png (1,552×941 px, 303 KB)

The fix seems to be working on auth.wikimedia.org for testwiki sign ups:

image.png (1,552×941 px, 377 KB)