get.disabled-by-permissions-policy.https.sub.html (2022B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="/permissions-policy/resources/permissions-policy.js"></script> 8 <script src="/common/get-host-info.sub.js"></script> 9 <body></body> 10 <script type="module"> 11 import { makeGetOptions } from "/digital-credentials/support/helper.js"; 12 const { HTTPS_REMOTE_ORIGIN } = get_host_info(); 13 const same_origin_src = 14 "/digital-credentials/permissions-policy/get.html"; 15 const cross_origin_src = new URL(same_origin_src, HTTPS_REMOTE_ORIGIN).href; 16 17 promise_test(async (test) => { 18 await test_driver.bless("user activation"); 19 await promise_rejects_dom( 20 test, 21 "NotAllowedError", 22 navigator.credentials.get(makeGetOptions({protocol: []})) 23 ); 24 }, "Permissions-Policy header digital-credentials-get=() disallows the top-level document."); 25 26 promise_test(async (test) => { 27 await test_feature_availability({ 28 feature_description: "Digital Credential API", 29 test, 30 src: same_origin_src, 31 expect_feature_available: expect_feature_unavailable_default, 32 is_promise_test: true, 33 needs_focus: true, 34 }); 35 }, "Permissions-Policy header digital-credentials-get=() disallows same-origin iframes."); 36 37 promise_test(async (test) => { 38 await test_feature_availability({ 39 feature_description: "Digital Credential API", 40 test, 41 src: cross_origin_src, 42 expect_feature_available: expect_feature_unavailable_default, 43 feature_name: "digital-credentials-get", 44 is_promise_test: true, 45 needs_focus: true, 46 }); 47 }, "Permissions-Policy header digital-credentials-get=() cannot be overridden using the allow attribute."); 48 49 </script>