Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta charset="utf-8" />
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="module">
import { makeGetOptions } 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 {
// Provide a complete correct request to test permission policy.
await navigator.credentials.get(makeGetOptions("openid4vp"));
// If no exception is thrown, then the feature is allowed by
// the permission policy.
enabled = true;
} catch (e) {
switch (e.name) {
// Unless a "NotAllowedError" exception is thrown, we assume
// the feature is allowed by permission policy. This is
// suitable for the tests that are using this helper method.
case "NotAllowedError":
enabled = false;
break;
default:
enabled = true;
break;
}
} finally {
window.parent.postMessage({ type, enabled }, "*");
}
}
test_driver.set_test_context(parent);
window.onload = notify;
</script>
<body>
<h1>Digital Credentials iframe</h1>
</body>