Skip to content

Commit b992903

Browse files
committed
Digital Credentials: Make user mediation implicit and always required
rdar://165597827 https://bugs.webkit.org/show_bug.cgi?id=303292 Reviewed by Pascoe. Removes mediation check requirement per spec change: w3c-fedid/digital-credentials#392 Include upstream WPT commit: web-platform-tests/wpt@1b72127 * LayoutTests/http/wpt/identity/formats/ISO18013/mobiledocument.https.html: * LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https.html: * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get.tentative.https-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/support/helper.js: * LayoutTests/platform/ios-18/TestExpectations: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/digital-credentials/get.tentative.https-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get.tentative.https-expected.txt. * LayoutTests/platform/mac-sequoia/TestExpectations: * Source/WebCore/Modules/identity/DigitalCredential.cpp: (WebCore::DigitalCredential::discoverFromExternalSource): Canonical link: https://commits.webkit.org/304676@main
1 parent 4fbda8f commit b992903

File tree

8 files changed

+26
-8
lines changed

8 files changed

+26
-8
lines changed

LayoutTests/http/wpt/identity/formats/ISO18013/mobiledocument.https.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
],
110110
},
111111
};
112+
await test_driver.bless();
112113
await promise_rejects_js(
113114
t,
114115
TypeError,

LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
digital: {
4141
requests: [{ protocol: "openid4vp", data: { } }],
4242
},
43-
mediation: "required",
4443
});
4544

4645
await promise_rejects_dom(t, "NotAllowedError", p);

LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get.tentative.https-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PASS navigator.credentials.get() promise is rejected if called with an aborted c
1010
PASS navigator.credentials.get() promise is rejected if called with an aborted signal in cross-origin iframe.
1111
PASS navigator.credentials.get() promise is rejected if abort controller is aborted after call to get().
1212
PASS navigator.credentials.get() promise is rejected if abort controller is aborted after call to get() in cross-origin iframe.
13-
FAIL Mediation is implicitly required and hence ignored. Request is aborted regardless. promise_rejects_js: function "function() { throw e; }" threw object "TypeError: User mediation is required for DigitalCredential." ("TypeError") expected instance of function "function Error() {
13+
FAIL Mediation is implicitly required and hence ignored. Request is aborted regardless. promise_rejects_js: function "function() { throw e; }" threw object "InvalidStateError: A credential picker operation is already in progress." ("InvalidStateError") expected instance of function "function Error() {
1414
[native code]
1515
}" ("Error")
1616
PASS Throws TypeError when request data is not JSON stringifiable.

LayoutTests/imported/w3c/web-platform-tests/digital-credentials/support/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const allMappings = {
146146
* @returns {TOptions}
147147
*/
148148
function makeCredentialOptionsFromConfig(config, mapping) {
149-
const { protocol, requests = [], data, mediation = "required", signal } = config;
149+
const { protocol, requests = [], data, mediation, signal } = config;
150150

151151
// Validate that we have either a protocol or requests
152152
if (!protocol && !requests?.length) {

LayoutTests/platform/ios-18/TestExpectations

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ imported/w3c/web-platform-tests/mixed-content/gen/top.http-rp/opt-in/sharedworke
108108
imported/w3c/web-platform-tests/mixed-content/gen/top.meta/opt-in/sharedworker-import-data.https.html [ Skip ]
109109
imported/w3c/web-platform-tests/mixed-content/gen/top.meta/unset/sharedworker-import-data.https.html [ Skip ]
110110

111+
# Digital Credentials supported added in iOS 26
112+
imported/w3c/web-platform-tests/digital-credentials/ [ Skip ]
113+
http/wpt/identity/ [ Skip ]
114+
111115
# -- The above has different, expected behavior on iOS 26 than iOS 18 --
112116
# -- New failure expectations below this point only!! --
113117

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
PASS Type conversion happens on the data member of the DigitalCredentialGetRequest object.
4+
PASS Calling navigator.credentials.get() without a digital member same origin.
5+
PASS navigator.credentials.get() API rejects if there are no credential request.
6+
PASS navigator.credentials.get() API rejects if there are no credential request for same-origin iframe.
7+
PASS navigator.credentials.get() API rejects if there are no credential request in cross-origin iframe.
8+
PASS navigator.credentials.get() promise is rejected if called with an aborted controller.
9+
PASS navigator.credentials.get() promise is rejected if called with an aborted controller in same-origin iframe.
10+
PASS navigator.credentials.get() promise is rejected if called with an aborted signal in cross-origin iframe.
11+
PASS navigator.credentials.get() promise is rejected if abort controller is aborted after call to get().
12+
PASS navigator.credentials.get() promise is rejected if abort controller is aborted after call to get() in cross-origin iframe.
13+
FAIL Mediation is implicitly required and hence ignored. Request is aborted regardless. promise_rejects_js: function "function() { throw e; }" threw object "InvalidStateError: A credential picker operation is already in progress." ("InvalidStateError") expected instance of function "function Error() {
14+
[native code]
15+
}" ("Error")
16+
PASS Throws TypeError when request data is not JSON stringifiable.
17+
PASS `requests` field is required in the options object.
18+

LayoutTests/platform/mac-sequoia/TestExpectations

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ imported/w3c/web-platform-tests/mixed-content/gen/top.http-rp/opt-in/sharedworke
3232
imported/w3c/web-platform-tests/mixed-content/gen/top.meta/opt-in/sharedworker-import-data.https.html [ Skip ]
3333
imported/w3c/web-platform-tests/mixed-content/gen/top.meta/unset/sharedworker-import-data.https.html [ Skip ]
3434
imported/w3c/web-platform-tests/digital-credentials/ [ Skip ]
35+
http/wpt/identity/ [ Skip ]
3536

3637
# -- The above has different, expected behavior on Tahoe than Sequoia --
3738
# -- New failure expectations for Sequoia below this point only!! --

Source/WebCore/Modules/identity/DigitalCredential.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ void DigitalCredential::discoverFromExternalSource(const Document& document, Cre
112112
{
113113
ASSERT(options.digital);
114114

115-
if (options.mediation != MediationRequirement::Required) {
116-
promise.reject(Exception { ExceptionCode::TypeError, "User mediation is required for DigitalCredential."_s });
117-
return;
118-
}
119-
120115
if (!PermissionsPolicy::isFeatureEnabled(PermissionsPolicy::Feature::DigitalCredentialsGetRule, document, PermissionsPolicy::ShouldReportViolation::No)) {
121116
promise.reject(Exception { ExceptionCode::NotAllowedError, "Third-party iframes are not allowed to call .get() unless explicitly allowed via Permissions Policy (digital-credentials-get)"_s });
122117
return;

0 commit comments

Comments
 (0)