mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Handle old Firefox versions that do not support isConditionalMediationAvailable (#25549)
Some versions of Firefox will throw a TypeError when calling PublicKeyCredential.isConditionalMediationAvailable() because the method does not exist. That would previously lead to a "Sorry, an error has occurred." modal when trying to login. This commit fixes the issue by properly checking if the method exists. Since it only affects older Firefox versions, no tests are added.
This commit is contained in:
@@ -133,7 +133,8 @@ export async function getPasskeyCredential(
|
||||
// We cannot do a general check because iOS Safari and Chrome in Selenium quietly support the feature
|
||||
// but they do not support the PublicKeyCredential.isConditionalMediationAvailable() method
|
||||
if (mediation === "conditional" && isFirefox) {
|
||||
const isCMA = await PublicKeyCredential.isConditionalMediationAvailable();
|
||||
const isCMA =
|
||||
(await PublicKeyCredential.isConditionalMediationAvailable?.()) ?? false;
|
||||
if (!isCMA) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user