forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Digital Credentials: implement visibility and focus requirements
https://bugs.webkit.org/show_bug.cgi?id=275782 rdar://130821648 Reviewed by Andy Estes. Adds visibility, focus, and user activation checks as per: See WICG/digital-credentials#129 * LayoutTests/http/wpt/identity/identitycredentialscontainer-get-basics.https.html: * LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https-expected.txt: Added. * LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https.html: Added. * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get-user-activation.https-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/digital-credentials/get-user-activation.https.html: Added. * LayoutTests/platform/ios/TestExpectations: * Source/WebCore/Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::scopeAndCrossOriginParent const): (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): (WebCore::CredentialsContainer::performCommonChecks): * Source/WebCore/Modules/credentialmanagement/CredentialsContainer.h: (WebCore::CredentialsContainer::document const): * Source/WebCore/Modules/identity/IdentityCredentialsContainer.cpp: (WebCore::IdentityCredentialsContainer::get): Canonical link: https://commits.webkit.org/281003@main
- Loading branch information
1 parent
2997bda
commit aadfa72
Showing
9 changed files
with
137 additions
and
12 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
LayoutTests/http/wpt/identity/identitycredentialscontainer-get-basics.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS navigator.identity.get() can't be used with hidden documents. | ||
|
45 changes: 45 additions & 0 deletions
45
LayoutTests/http/wpt/identity/identitycredentialscontainer-get-hidden.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8" /> | ||
<title> | ||
Digital Credential API: get() can't be used with hidden documents. | ||
</title> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body></body> | ||
<script> | ||
promise_setup(async () => { | ||
if (document.visibilityState !== "hidden") { | ||
await new Promise((resolve) => { | ||
document.onvisibilitychange = resolve; | ||
testRunner.setPageVisibility("hidden"); | ||
}); | ||
} | ||
}); | ||
|
||
promise_test(async function (test) { | ||
this.add_cleanup(() => { | ||
testRunner.setPageVisibility("visible"); | ||
}); | ||
|
||
assert_equals( | ||
document.visibilityState, | ||
"hidden", | ||
"now should be hidden" | ||
); | ||
|
||
await test_driver.bless(); | ||
|
||
assert_true( | ||
navigator.userActivation.isActive, | ||
"User activation should be active after test_driver.bless()." | ||
); | ||
|
||
await promise_rejects_dom( | ||
test, | ||
"NotAllowedError", | ||
navigator.identity.get({}) | ||
); | ||
}, "navigator.identity.get() can't be used with hidden documents."); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
...mported/w3c/web-platform-tests/digital-credentials/get-user-activation.https-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS navigator.identity.get() calling the API without user activation should reject with NotAllowedError. | ||
PASS navigator.identity.get() consumes user activation. | ||
|
33 changes: 33 additions & 0 deletions
33
...tTests/imported/w3c/web-platform-tests/digital-credentials/get-user-activation.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<title>Digital Credential API: get() consumes user activation.</title> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<body></body> | ||
<script> | ||
promise_test(async (t) => { | ||
assert_false( | ||
navigator.userActivation.isActive, | ||
"User activation should not be active" | ||
); | ||
await promise_rejects_dom(t, "NotAllowedError", navigator.identity.get({})); | ||
}, "navigator.identity.get() calling the API without user activation should reject with NotAllowedError."); | ||
|
||
promise_test(async (t) => { | ||
await test_driver.bless(); | ||
assert_true( | ||
navigator.userActivation.isActive, | ||
"User activation should be active after test_driver.bless()." | ||
); | ||
await promise_rejects_dom( | ||
t, | ||
"NotSupportedError", | ||
navigator.identity.get({}) | ||
); | ||
assert_false( | ||
navigator.userActivation.isActive, | ||
"User activation should be consumed after navigator.identity.get()." | ||
); | ||
}, "navigator.identity.get() consumes user activation."); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters