Bug 258911 - [WebAuthn] .catch() for conditional mediation is not passed the abortreason that was thrown
Summary: [WebAuthn] .catch() for conditional mediation is not passed the abortreason t...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-05 22:21 PDT by sweeden
Modified: 2023-07-12 22:22 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sweeden 2023-07-05 22:21:48 PDT
Consider I have a WebAuthn conditional mediation call (with appropriate abortController established), with a catch block such as:

navigator.credentials.get(publicKey)
.then((assertion) => {})
.catch((error) => {});

This bug is in relation to the type and value of "error" above, when the call is aborted with something like:
abortController.abort("AbortError");


According to step 3 of section 2.5.1 of the credential management API (see https://w3c.github.io/webappsec-credential-management/#algorithm-request) if the autofill navigator.credentials.get call is aborted, then the promise should be rejected "with options.signal’s abort reason". According to this reference (https://dom.spec.whatwg.org/#abortsignal-abort-reason) abort reason is "a JavaScript value" - though it is not entirely clear what that means.

The way I read it, I would have expected the value of "error" in the catch block to be the string "AbortError" - ie. what is thrown as the reason in the call to abort(), and this is indeed what I see in Chrome.

In Safari, typeof(error) returns "object", so the thing passed to the rejected promise is not the plain string abort reason.

This lack of consistency makes it difficult to write portable code in the catch block of mediated WebAuthn calls. 

I'm opening this defect to seek clarification on whether or not this is seen by the WebKit team as a bug, and if not, what the reasoning is.
Comment 1 Radar WebKit Bug Importer 2023-07-12 22:22:14 PDT
<rdar://problem/112178073>