1
0
Fork 0
firefox/testing/web-platform/tests/permissions-policy/resources/digital-credentials-create.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

35 lines
1.1 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8" />
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="module">
import { makeCreateOptions } from "/digital-credentials/support/helper.js";
const type = "availability-result";
async function notify() {
if (!navigator.userActivation.isActive) {
await test_driver.bless("user activation", null, window);
}
let enabled = undefined;
try {
await navigator.credentials.create(makeCreateOptions([]));
} catch (e) {
switch (e.name) {
case "NotAllowedError":
enabled = false;
break;
case "TypeError":
enabled = true;
break;
default:
throw e;
}
} finally {
window.parent.postMessage({ type, enabled }, "*");
}
}
test_driver.set_test_context(parent);
window.onload = notify;
</script>
<body>
<h1>Digital Credentials iframe</h1>
</body>