Files
sousa-gecko/dom/webauthn/WinWebAuthnService.h
T
John M. Schanck e1b617cb11 Bug 2040462 - allow simultaneous conditional gets in different browsing contexts. r=keeler,credential-management-reviewers,dimi
Allow each browsing context to have a in-flight conditional get request.

A "conditionally mediated" WebAuthn request is a site's intention to submit a
request in response to user interaction with browser-presented autofill UI. The
WebAuthn spec only allows one active request at a time, but a conditional
request can stay pending while another request is active. Prior to this patch we
incorrectly applied the uniqueness requirement to conditional requests.

The previous design had some other deficiencies as well. We held pending
requests at the level of the platform nsIWebAuthnService, which meant we had
duplicate logic for dispatching a pending request at each service. This patch
hoists the pending request management up to the top level WebAuthnService, adds
a new GetAutoFillEntriesForRpId method which allows WebAuthnService to request
autofill entries from the platform-specific service, and simplifies the state
management at the platform level.

As part of this refactor it was natural to also remove some unnecessary
synchronization mechanisms from the platform-specific nsIWebAuthnServices. Back
when WebAuthnTransactionParent ran on the IPDL Background Thread we needed these
synchronization mechanisms to allow prompts / main thread UI to cancel WebAuthn
operations. This has not been necessary since Bug 1945969, which moved
WebAuthnTransactionParent to the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D301134
2026-05-28 19:38:08 +00:00

41 lines
1.0 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_WinWebAuthnService_h
#define mozilla_dom_WinWebAuthnService_h
#include "mozilla/dom/PWebAuthnTransaction.h"
#include "nsIWebAuthnService.h"
namespace mozilla::dom {
class WinWebAuthnService final : public nsIWebAuthnService {
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIWEBAUTHNSERVICE
static bool IsUserVerifyingPlatformAuthenticatorAvailable();
static bool AreWebAuthNApisAvailable();
static nsresult EnsureWinWebAuthnModuleLoaded();
WinWebAuthnService() = default;
private:
~WinWebAuthnService();
uint32_t GetWebAuthNApiVersion();
struct TransactionState {
uint64_t transactionId;
GUID cancellationId;
};
// Main thread only:
Maybe<TransactionState> mActiveTransaction;
};
} // namespace mozilla::dom
#endif // mozilla_dom_WinWebAuthnService_h