Define "present credential requests" algorithm.#419
Conversation
26f5b15 to
a98d215
Compare
…if AbortSignal races with picker result rdar://163295172 https://bugs.webkit.org/show_bug.cgi?id=305363 Reviewed by Pascoe. Fix race and crash in CredentialRequestCoordinator by settling promises only after picker teardown and safely handling abort reasons. Ensure credential requests always settle after the picker UI has fully torn down. This change: - Defers promise settlement until the picker dismiss callback fires - Better handles aborts during presentation and teardown - Avoids capturing unprotected JSValues across async boundaries - Keeps coordinator state transitions more consistent (with better checks) It also more closely follows the spec: w3c-fedid/digital-credentials#420 w3c-fedid/digital-credentials#419 * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get.tentative.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/non-fully-active.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/non-fully-active.https.html: * Source/WebCore/Modules/identity/CredentialRequestCoordinator.cpp: (WebCore::CredentialRequestCoordinator::PickerStateGuard::PickerStateGuard): (WebCore::CredentialRequestCoordinator::PickerStateGuard::~PickerStateGuard): (WebCore::CredentialRequestCoordinator::setState): (WebCore::CredentialRequestCoordinator::prepareCredentialRequest): (WebCore::CredentialRequestCoordinator::handleDigitalCredentialsPickerResult): (WebCore:: const): (WebCore::CredentialRequestCoordinator::dismissPickerAndSettle): (WebCore::CredentialRequestCoordinator::abortPicker): (WebCore::CredentialRequestCoordinator::contextDestroyed): (WebCore::CredentialRequestCoordinator::~CredentialRequestCoordinator): (): Deleted. (WebCore::CredentialRequestCoordinator::presentPicker): Deleted. (WebCore::CredentialRequestCoordinator::finalizeDigitalCredential): Deleted. * Source/WebCore/Modules/identity/CredentialRequestCoordinator.h: * Source/WebCore/Modules/identity/DigitalCredential.cpp: (WebCore::DigitalCredential::discoverFromExternalSource): * Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations: Canonical link: https://commits.webkit.org/305868@main
mohamedamir
left a comment
There was a problem hiding this comment.
I like the direction in general, I have added a couple of comments
Thank you, @marcoscaceres
|
Discussed in 21 January 2026 Series B call |
d2b7e3f to
53206fd
Compare
|
Discussed on 2026-02-09 call. Editors will bring this back to the group after more research for best practices and to suggest direction. |
|
Discussed at the 20 April 2026 call. Note the idea to create a list of v2 (breaking changes) items for DC API, including calling origin and top level origin. Will bring back to next week's call. |
Co-authored-by: Mohamed Amir Yosef <mohamed.amir@gmail.com> Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
- Replace selectedRequest with platform-returned protocol identifier, since neither WebKit nor Chromium know which request was selected - Rename parsedDataOrError to parsedResponseDataOrError for clarity - Move JSON parsing, validation, and credential construction inside the queued global task so they execute in the correct realm - Unify success/error ordering: cleanup abort, settle promise, null active promise, set idle (eliminates double-task-hop for errors) - Remove document origin from request context (CTAP only supports one origin, Chromium does not send it); tracked in #504 - Derive top-level origin from environment settings object - Rename "top origin" to "top-level origin" for clarity - Wrap chooser and response handling in [=In parallel=] - Fix "wait for the user to do" framing to "wait for outcomes" - Fix grammar in abort note and protocol note
|
@mohamedamir all suggestions applied. @hlflanagan, @mohamedamir filed a bug about the iframe's origin #504 to fix in the future. I think we are done 🥳 Confirmed that apart from a few error codes this matches 1:1 both WebKit and Chrome. |
timcappalli
left a comment
There was a problem hiding this comment.
LGTM with the name change (initiate)
…redential request" Agent-Logs-Url: https://github.com/w3c-fedid/digital-credentials/sessions/727fd1f7-e1e3-48d7-a636-a4c14b7590a1 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
mohamedamir
left a comment
There was a problem hiding this comment.
LGTM after replacing all mentions of "present" with "initiate"
Co-authored-by: Mohamed Amir Yosef <mamir@chromium.org>
SHA: 0bbd3e3 Reason: push, by marcoscaceres Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Defines the "present the credential request" algorithm — the core user-facing part of the Digital Credentials flow that happens after validation passes.
What the algorithm does
Once the credential requests have been validated (by the "prepare" algorithm), this algorithm:
AbortSignal.AbortError.NotAllowedError(permission denied),TypeError(malformed request data),InvalidStateError(concurrent request), orOperationError(catch-all).DigitalCredentialinstance withdataandprotocol, resolves the promise, and cleans up coordinator state.New terms introduced
requests,top origin, anddocument origininto the chooserCloses #419
The following tasks have been completed:
Implementation commitment:
Documentation and checks
Preview | Diff