Bug 242002 - preventSilentAccess throws NotSupportedError
Summary: preventSilentAccess throws NotSupportedError
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-25 08:25 PDT by Luke Warlow
Modified: 2023-05-22 12:37 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Warlow 2022-06-25 08:25:40 PDT
Safari has "implemented" the `preventSilentAccess` function from the Credential Management API (https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-preventsilentaccess).

However, it unconditionally throws a NotSupportedError whenever it's called. This happens on both macOS and iOS from my testing.

The specification doesn't mention this as an expected behaviour and I was surprised to see that the function is implemented but also not implemented, meaning my feature detection looking for the existence of the function fails.

The below code can be pasted into Web Inspector on a secure domain to demonstrate the issue. Both Chromium and Firefox work correctly but Safari fails.

if (navigator.credentials.preventSilentAccess) {
	console.log('preventSilentAccess is implemented');
  navigator.credentials.preventSilentAccess()
		.then(() => {
			console.log('preventSilentAccess succeeded');
		})
    .catch((err) => {
			console.log('preventSilentAccess failed');
      
      console.error(err);
		});
	
} else {
	console.log('preventSilentAccess is NOT implemented');
}
Comment 1 Radar WebKit Bug Importer 2022-06-27 16:32:07 PDT
<rdar://problem/96020741>
Comment 2 Alexey Proskuryakov 2022-06-27 16:35:51 PDT
This is definitely how it is implemented indeed. It's been a long time since this code was added, and I couldn't find any explanation of why it was done this way.

void CredentialsContainer::preventSilentAccess(DOMPromiseDeferred<void>&& promise) const
{
    promise.reject(Exception { NotSupportedError, "Not implemented."_s });
}
Comment 3 Luke Warlow 2023-03-09 09:02:15 PST
Pull request: https://github.com/WebKit/WebKit/pull/11303
Comment 4 EWS 2023-05-22 12:37:22 PDT
Committed 264345@main (40294715d0c0): <https://commits.webkit.org/264345@main>

Reviewed commits have been landed. Closing PR #11303 and removing active labels.