mirror of
https://github.com/servo/servo.git
synced 2025-07-03 21:43:41 +01:00
103 lines
3.2 KiB
HTML
103 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=/resources/WebIDLParser.js></script>
|
|
<script src=/resources/idlharness.js></script>
|
|
<script type="text/plain" id="untested">
|
|
dictionary CredentialData {
|
|
USVString id;
|
|
};
|
|
|
|
[Exposed=Window, SecureContext]
|
|
interface Credential {
|
|
readonly attribute USVString id;
|
|
readonly attribute DOMString type;
|
|
};
|
|
|
|
[NoInterfaceObject, SecureContext]
|
|
interface CredentialUserData {
|
|
readonly attribute USVString name;
|
|
readonly attribute USVString iconURL;
|
|
};
|
|
|
|
dictionary PasswordCredentialData : CredentialData {
|
|
USVString name;
|
|
USVString iconURL;
|
|
required USVString password;
|
|
};
|
|
|
|
typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit;
|
|
|
|
typedef (FormData or URLSearchParams) CredentialBodyType;
|
|
|
|
|
|
dictionary FederatedCredentialInit : CredentialData {
|
|
USVString name;
|
|
USVString iconURL;
|
|
required USVString provider;
|
|
DOMString protocol;
|
|
};
|
|
|
|
dictionary CredentialCreationOptions {
|
|
PasswordCredentialInit? password;
|
|
FederatedCredentialInit? federated;
|
|
};
|
|
|
|
enum CredentialMediationRequirement {
|
|
"silent",
|
|
"optional",
|
|
"required"
|
|
};
|
|
|
|
dictionary CredentialRequestOptions {
|
|
boolean password = false;
|
|
FederatedCredentialRequestOptions federated;
|
|
|
|
CredentialMediationRequirement mediation = "optional";
|
|
};
|
|
|
|
dictionary FederatedCredentialRequestOptions {
|
|
sequence<USVString> providers;
|
|
sequence<DOMString> protocols;
|
|
};
|
|
|
|
</script>
|
|
<script type="text/plain" id="tested">
|
|
[Exposed=Window, SecureContext]
|
|
interface CredentialsContainer {
|
|
Promise<Credential> get(optional CredentialRequestOptions options);
|
|
Promise<Credential> store(Credential credential);
|
|
Promise<Credential?> create(optional CredentialCreationOptions options);
|
|
Promise<void> preventSilentAccess();
|
|
};
|
|
|
|
[Constructor(PasswordCredentialData data),
|
|
Constructor(HTMLFormElement form),
|
|
Exposed=Window,
|
|
SecureContext]
|
|
interface PasswordCredential : Credential {
|
|
readonly attribute DOMString password;
|
|
};
|
|
PasswordCredential implements CredentialUserData;
|
|
|
|
[Constructor(FederatedCredentialInit data),
|
|
Exposed=Window,
|
|
SecureContext]
|
|
interface FederatedCredential : Credential {
|
|
readonly attribute USVString provider;
|
|
readonly attribute DOMString? protocol;
|
|
};
|
|
FederatedCredential implements CredentialUserData;
|
|
</script>
|
|
<script>
|
|
"use strict";
|
|
var idl_array = new IdlArray();
|
|
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
|
|
idl_array.add_idls(document.querySelector('#tested').textContent);
|
|
idl_array.add_objects({
|
|
CredentialsContainer: ['navigator.credentials'],
|
|
PasswordCredential: ['new PasswordCredential({ id: "id", password: "pencil", iconURL: "https://example.com/", name: "name" })'],
|
|
FederatedCredential: ['new FederatedCredential({ id: "id", provider: "https://example.com", iconURL: "https://example.com/", name: "name" })']
|
|
});
|
|
idl_array.test();
|
|
</script>
|