Skip to content

Commit a16d4de

Browse files
authored
Removes the mandatory mediation requirement for digital credentials API (#55359)
* Removes the mandatory mediation requirement for creating and getting digital credentials. * Add test that request is aborted regardless of the mediation
1 parent 6f219db commit a16d4de

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

digital-credentials/allow-attribute-with-create.https.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
// Results in TypeError when allowed, NotAllowedError when disallowed
108108
requests: [],
109109
},
110-
mediation: "required",
111110
};
112111
const { data } = await new Promise((resolve) => {
113112
window.addEventListener("message", resolve, {

digital-credentials/allow-attribute-with-get.https.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
// NotAllowedError when disallowed
109109
requests: [],
110110
},
111-
mediation: "required",
112111
};
113112
await test_driver.bless("User activation");
114113
const { data } = await new Promise((resolve) => {

digital-credentials/create.tentative.https.html

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
const iframeSameOrigin = document.querySelector("iframe#same-origin");
1919
const iframeCrossOrigin = document.querySelector("iframe#cross-origin");
20-
const mediations = ["silent", "optional", "conditional", "required"];
2120

2221
promise_setup(async () => {
2322
const hostInfo = get_host_info();
@@ -209,6 +208,8 @@
209208
}, "navigator.credentials.create() promise is rejected if abort controller is aborted after call to create() in cross-origin iframe.");
210209

211210
promise_test(async (t) => {
211+
/** @type sequence<CredentialMediationRequirement> */
212+
const mediations = ["silent", "optional", "conditional", "required"];
212213
const abortController = new AbortController();
213214
const { signal } = abortController;
214215
abortController.abort();
@@ -219,16 +220,7 @@
219220
});
220221
await promise_rejects_dom(t, "AbortError", requestPromise);
221222
}
222-
}, "Adding mediations together with abort signal respects the abort signal.");
223-
224-
promise_test(async (t) => {
225-
/** @type sequence<CredentialMediationRequirement> */
226-
const disallowedMediations = [ "conditional", "optional", "silent"];
227-
for (const mediation of disallowedMediations) {
228-
const options = makeCreateOptions("default", mediation);
229-
await promise_rejects_js(t, TypeError, navigator.credentials.create(options));
230-
}
231-
}, "Mediation is required to create a DigitalCredential.");
223+
}, "Mediation is implicitly required and hence ignored. Request is aborted regardless.");
232224

233225
promise_test(async (t) => {
234226
await promise_rejects_js(

digital-credentials/get.tentative.https.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,18 @@
233233

234234
promise_test(async (t) => {
235235
/** @type sequence<CredentialMediationRequirement> */
236-
const disallowedMediations = ["conditional", "optional", "silent"];
237-
for (const mediation of disallowedMediations) {
238-
const options = makeGetOptions("default", mediation);
239-
await promise_rejects_js(
240-
t,
241-
TypeError,
242-
navigator.credentials.get(options)
243-
);
236+
const mediations = ["silent", "optional", "conditional", "required"];
237+
const abortController = new AbortController();
238+
const { signal } = abortController;
239+
abortController.abort();
240+
for (const mediation of mediations) {
241+
const requestPromise = navigator.credentials.get({
242+
mediation,
243+
signal,
244+
});
245+
await promise_rejects_dom(t, "AbortError", requestPromise);
244246
}
245-
}, "Mediation is required to get a DigitalCredential.");
247+
}, "Mediation is implicitly required and hence ignored. Request is aborted regardless.");
246248

247249
promise_test(async t => {
248250
const throwingValues = [

0 commit comments

Comments
 (0)