From c2e623f3539d2843b6091ed9bf3fdf4821fecdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Pe=C3=B1a=20Moreno?= Date: Wed, 7 Aug 2024 17:05:34 -0400 Subject: [PATCH] switch --- spec/index.bs | 64 +++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 70ea88ac..827f4d80 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -1013,36 +1013,40 @@ throwing the exception. 1. If |accState| is [=compute the connection status/connected=], set |registeredAccount| to |acc| and increase |numRegisteredAccounts| by 1. 1. Let |permission|, |disclosureTextShown|, and |isAutoSelected| be set to false. - 1. If |mediation| is not "{{CredentialMediationRequirement/required}}", |requiresUserMediation| - is false, and |numRegisteredAccounts| is equal to 1: - 1. Set |account| to |registeredAccount| and |accountState| to the result of running - [=compute the connection status=] algorithm given |provider| and |account|. When doing this, - the user agent MAY show some UI to the user indicating that they are being - auto-reauthenticated. - 1. Set |isAutoSelected| to true. - 1. Else if |mediation| is "{{CredentialMediationRequirement/silent}}", return (failure, false). - 1. Else if |accountsList|'s size is 1: - 1. Set |account| to |accountsList|[0]. - 1. Set |accountState| to the result of running the [=compute the connection status=] algorithm - given |provider|, |account|, and |globalObject|. - 1. If |accountState| is [=compute the connection status/disconnected=], - let |permission| be the result of running [=request permission to sign-up=] algorithm - with |account|, |accountState|, |config|, |provider|, and |globalObject|. Also set - |disclosureTextShown| to true. - 1. Else, show a dialog to request user permission to sign in via |account|, and set the - result in |permission|. The user agent MAY use |options|'s - {{IdentityCredentialRequestOptions/context}} to customize the dialog. - 1. Else: - 1. Set |account| to the result of running the [=select an account=] from the - |accountsList|. - 1. If |account| is failure, return (failure, true). - 1. Set |accountState| to the result of running the [=compute the connection status=] algorithm - given |provider| and |account|. - 1. If |accountState| is [=compute the connection status/disconnected=]: - 1. Let |permission| be the result of running the [=request permission to sign-up=] - algorithm with |account|, |config|, |provider|, and |globalObject|. - 1. Set |disclosureTextShown| to true. - 1. Else, set |permission| to true. + 1. Perform the set of instructions corresponding to the first matching statement: +
+
If |mediation| is not "{{CredentialMediationRequirement/required}}", |requiresUserMediation| + is false, and |numRegisteredAccounts| is equal to 1:
+ 1. Set |account| to |registeredAccount| and |accountState| to the result of running + [=compute the connection status=] algorithm given |provider| and |account|. When doing this, + the user agent MAY show some UI to the user indicating that they are being + auto-reauthenticated. + 1. Set |isAutoSelected| to true. +
If |mediation| is "{{CredentialMediationRequirement/silent}}":
+ 1. Return (failure, false). +
If |accountsList|'s size is 1:
+ 1. Set |account| to |accountsList|[0]. + 1. Set |accountState| to the result of running the [=compute the connection status=] algorithm + given |provider|, |account|, and |globalObject|. + 1. If |accountState| is [=compute the connection status/disconnected=], + let |permission| be the result of running [=request permission to sign-up=] algorithm + with |account|, |accountState|, |config|, |provider|, and |globalObject|. Also set + |disclosureTextShown| to true. + 1. Otherwise, show a dialog to request user permission to sign in via |account|, and set the + result in |permission|. The user agent MAY use |options|'s + {{IdentityCredentialRequestOptions/context}} to customize the dialog. +
Otherwise:
+ 1. Set |account| to the result of running the [=select an account=] from the + |accountsList|. + 1. If |account| is failure, return (failure, true). + 1. Set |accountState| to the result of running the [=compute the connection status=] algorithm + given |provider| and |account|. + 1. If |accountState| is [=compute the connection status/disconnected=]: + 1. Let |permission| be the result of running the [=request permission to sign-up=] + algorithm with |account|, |config|, |provider|, and |globalObject|. + 1. Set |disclosureTextShown| to true. + 1. Otherwise, set |permission| to true. +
1. Wait until the [=user agent=]'s dialogs requesting for user choice or permission to be closed, if any are created in the previous steps. 1. Assert: |account| is not null.