Bug 1473212 [wpt PR 9844] - Update the webappsec-credential-management IDL file, a=testonly

Automatic update from web-platform-testsUpdate the webappsec-credential-management IDL file (#9844)

* Add webappsec-credential-management idl file

* Updated webappsec-credential-management IDL file

* Clean up tests

--

wpt-commits: 89e834cdc90e696798083d87d1a360d46689e97b
wpt-pr: 9844
This commit is contained in:
Luke Bjerring 2018-07-06 23:19:52 +00:00 коммит произвёл James Graham
Родитель 99c54b570a
Коммит 7c644c9e1d
5 изменённых файлов: 156 добавлений и 123 удалений

Просмотреть файл

@ -288953,6 +288953,11 @@
{}
]
],
"interfaces/credential-management.idl": [
[
{}
]
],
"interfaces/css-animations.idl": [
[
{}
@ -316383,9 +316388,9 @@
{}
]
],
"credential-management/idl.https.html": [
"credential-management/idlharness.https.window.js": [
[
"/credential-management/idl.https.html",
"/credential-management/idlharness.https.window.html",
{}
]
],
@ -442594,8 +442599,8 @@
"561636e62d50da2d14e50516c62cbaea1c5bb924",
"testharness"
],
"credential-management/idl.https.html": [
"e9a108beef51c52bbaaf2e53371aec57e69541c0",
"credential-management/idlharness.https.window.js": [
"9680556aa4d42fa7f86451640a2860caee06a042",
"testharness"
],
"credential-management/passwordcredential-framed-get.sub.https.html": [
@ -593294,6 +593299,10 @@
"d7f133c8dd6e1656f82c077d9795714827b9c869",
"support"
],
"interfaces/credential-management.idl": [
"29a0bcde9ddd6629c7bf05757cea45c831fe9a6b",
"support"
],
"interfaces/css-animations.idl": [
"520ed1f6d245c75551aed3f74f988026edf3ff59",
"support"
@ -625323,7 +625332,7 @@
"support"
],
"webauthn/interfaces.https.any.js": [
"3ca7a0855f38bf8d0250d0a352dd60c2ee6515fa",
"f143ec75c75322b368f808d7d36be5b7d4cb3c62",
"testharness"
],
"webauthn/securecontext.http.html": [

Просмотреть файл

@ -1,103 +0,0 @@
<!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>

Просмотреть файл

@ -0,0 +1,35 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/webappsec-credential-management/
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/credential-management.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
var idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
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();
})

Просмотреть файл

@ -0,0 +1,103 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Credential Management Level 1" spec.
// See: https://w3c.github.io/webappsec-credential-management/
[Exposed=Window, SecureContext]
interface Credential {
readonly attribute USVString id;
readonly attribute DOMString type;
};
[SecureContext]
interface mixin CredentialUserData {
readonly attribute USVString name;
readonly attribute USVString iconURL;
};
partial interface Navigator {
[SecureContext, SameObject] readonly attribute CredentialsContainer credentials;
};
[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();
};
dictionary CredentialData {
required USVString id;
};
dictionary CredentialRequestOptions {
CredentialMediationRequirement mediation = "optional";
AbortSignal signal;
};
enum CredentialMediationRequirement {
"silent",
"optional",
"required"
};
dictionary CredentialCreationOptions {
AbortSignal signal;
};
typedef (FormData or URLSearchParams) CredentialBodyType;
[Constructor(HTMLFormElement form),
Constructor(PasswordCredentialData data),
Exposed=Window,
SecureContext]
interface PasswordCredential : Credential {
readonly attribute USVString password;
};
PasswordCredential includes CredentialUserData;
partial dictionary CredentialRequestOptions {
boolean password = false;
};
dictionary PasswordCredentialData : CredentialData {
USVString name;
USVString iconURL;
required USVString password;
};
typedef (PasswordCredentialData or HTMLFormElement) PasswordCredentialInit;
partial dictionary CredentialCreationOptions {
PasswordCredentialInit password;
};
[Constructor(FederatedCredentialInit data),
Exposed=Window,
SecureContext]
interface FederatedCredential : Credential {
readonly attribute USVString provider;
readonly attribute DOMString? protocol;
};
FederatedCredential includes CredentialUserData;
dictionary FederatedCredentialRequestOptions {
sequence<USVString> providers;
sequence<DOMString> protocols;
};
partial dictionary CredentialRequestOptions {
FederatedCredentialRequestOptions federated;
};
dictionary FederatedCredentialInit : CredentialData {
USVString name;
USVString iconURL;
required USVString provider;
DOMString protocol;
};
partial dictionary CredentialCreationOptions {
FederatedCredentialInit federated;
};

Просмотреть файл

@ -1,28 +1,17 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
if (self.importScripts) {
importScripts('/resources/testharness.js');
importScripts('/resources/WebIDLParser.js', '/resources/idlharness.js');
}
// https://w3c.github.io/webauthn/
'use strict';
promise_test(async () => {
const webauthnIdl = await fetch('/interfaces/webauthn.idl').then(r => r.text());
const creds = await fetch('/interfaces/credential-management.idl').then(r => r.text());
const idlArray = new IdlArray();
idlArray.add_idls(webauthnIdl);
// static IDL tests
idlArray.add_untested_idls('interface CredentialCreationOptions {};');
idlArray.add_untested_idls('interface CredentialRequestOptions {};');
idlArray.add_untested_idls("interface Navigator { };");
idlArray.add_untested_idls("interface Credential { };");
// TODO: change to "tested" for real browsers?
idlArray.add_untested_idls("partial interface Navigator { readonly attribute WebAuthentication authentication; };");
idlArray.add_dependency_idls(creds);
idlArray.add_objects({
WebAuthentication: ["navigator.authentication"]
});