summaryrefslogtreecommitdiffstats
path: root/dom/webauthn
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/webauthn
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webauthn')
-rw-r--r--dom/webauthn/MacOSWebAuthnService.mm21
-rw-r--r--dom/webauthn/moz.build2
2 files changed, 22 insertions, 1 deletions
diff --git a/dom/webauthn/MacOSWebAuthnService.mm b/dom/webauthn/MacOSWebAuthnService.mm
index 79b9030541..cec9600e57 100644
--- a/dom/webauthn/MacOSWebAuthnService.mm
+++ b/dom/webauthn/MacOSWebAuthnService.mm
@@ -545,6 +545,19 @@ MacOSWebAuthnService::MakeCredential(uint64_t aTransactionId,
"MacOSWebAuthnService::MakeCredential",
[self = RefPtr{this}, browsingContextId(aBrowsingContextId),
aArgs = nsCOMPtr{aArgs}, aPromise = nsCOMPtr{aPromise}]() {
+ // Bug 1884574 - The Reset() call above should have cancelled any
+ // transactions that were dispatched to the platform, the platform
+ // should have called didCompleteWithError, and didCompleteWithError
+ // should have rejected the pending promise. However, in some scenarios,
+ // the platform fails to call the callback, and this leads to a
+ // diagnostic assertion failure when we drop `mRegisterPromise`. Avoid
+ // this by aborting the transaction here.
+ if (self->mRegisterPromise) {
+ MOZ_LOG(gMacOSWebAuthnServiceLog, mozilla::LogLevel::Debug,
+ ("MacOSAuthenticatorRequestDelegate::MakeCredential: "
+ "platform failed to call callback"));
+ self->AbortTransaction(NS_ERROR_DOM_ABORT_ERR);
+ }
self->mRegisterPromise = aPromise;
nsAutoString rpId;
@@ -847,6 +860,14 @@ void MacOSWebAuthnService::DoGetAssertion(
[self = RefPtr{this}, browsingContextId(aBrowsingContextId), aArgs,
aPromise,
aSelectedCredentialId = std::move(aSelectedCredentialId)]() mutable {
+ // Bug 1884574 - This AbortTransaction call is necessary.
+ // See comment in MacOSWebAuthnService::MakeCredential.
+ if (self->mSignPromise) {
+ MOZ_LOG(gMacOSWebAuthnServiceLog, mozilla::LogLevel::Debug,
+ ("MacOSAuthenticatorRequestDelegate::DoGetAssertion: "
+ "platform failed to call callback"));
+ self->AbortTransaction(NS_ERROR_DOM_ABORT_ERR);
+ }
self->mSignPromise = aPromise;
nsAutoString rpId;
diff --git a/dom/webauthn/moz.build b/dom/webauthn/moz.build
index 5d84dc06e7..47309034c8 100644
--- a/dom/webauthn/moz.build
+++ b/dom/webauthn/moz.build
@@ -70,7 +70,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
"AndroidWebAuthnService.cpp",
]
-if CONFIG["OS_ARCH"] == "Darwin":
+if CONFIG["TARGET_OS"] == "OSX":
UNIFIED_SOURCES += [
"MacOSWebAuthnService.mm",
]