ch-ua-high-entropy-values-permissions-policy-attribute.https.sub.html (2664B)
1 <!DOCTYPE html> 2 <body> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="../../permissions-policy/resources/permissions-policy.js"></script> 6 <script> 7 const same_origin_src = 8 "/permissions-policy/resources/permissions-policy-ch-ua-high-entropy-values.html"; 9 const cross_origin_src = 10 "https://{{hosts[alt][]}}:{{ports[https][0]}}" + same_origin_src; 11 const feature_name = 'permissions policy "ch-ua-high-entropy-values"'; 12 const header_none = 'allow="ch-ua-high-entropy-values \'none\'" attribute'; 13 const header_self = 'allow="ch-ua-high-entropy-values" attribute'; 14 15 async_test((test) => { 16 return test_feature_availability({ 17 feature_description: "navigator.userAgentData.getHighEntropyValues()", 18 test, 19 src: same_origin_src, 20 expect_feature_available: expect_feature_available_default, 21 }); 22 }, `${feature_name} is enabled by default`); 23 24 async_test((test) => { 25 return test_feature_availability({ 26 feature_description: "navigator.userAgentData.getHighEntropyValues()", 27 test, 28 src: same_origin_src, 29 expect_feature_available: expect_feature_unavailable_default, 30 feature_name: "ch-ua-high-entropy-values 'none'" 31 }); 32 }, `${feature_name} disabled in same-origin iframe using ${header_none}`); 33 34 async_test((test) => { 35 return test_feature_availability({ 36 feature_description: "navigator.userAgentData.getHighEntropyValues()", 37 test, 38 src: cross_origin_src, 39 expect_feature_available: expect_feature_unavailable_default, 40 feature_name: "ch-ua-high-entropy-values 'none'" 41 }); 42 }, `${feature_name} disabled in cross-origin iframe using ${header_none}`); 43 44 async_test((test) => { 45 return test_feature_availability({ 46 feature_description: "navigator.userAgentData.getHighEntropyValues()", 47 test, 48 src: same_origin_src, 49 expect_feature_available: expect_feature_available_default, 50 feature_name: "ch-ua-high-entropy-values" 51 }); 52 }, `${feature_name} can be enabled in same-origin iframe using ${header_self}`); 53 54 async_test((test) => { 55 return test_feature_availability({ 56 feature_description: "navigator.userAgentData.getHighEntropyValues()", 57 test, 58 src: cross_origin_src, 59 expect_feature_available: expect_feature_available_default, 60 feature_name: "ch-ua-high-entropy-values" 61 }); 62 }, `${header_self} allows high-entropy values via getHighEntropyValues() in cross-origin iframes.`); 63 </script> 64 </body>