default-enabled-features-allow-unspecified.https.html (2430B)
1 <!DOCTYPE html> 2 <title>Test permission policies with no permissions specified</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/utils.js"></script> 6 <script src="/common/dispatcher/dispatcher.js"></script> 7 <script src="resources/utils.js"></script> 8 <script src="/common/get-host-info.sub.js"></script> 9 <script src="resources/default-enabled-features-helper.js"></script> 10 11 <body> 12 <script> 13 promise_test(async(t) => { 14 const fencedframe = await attachFencedFrameContext({ 15 origin: get_host_info().ORIGIN}); 16 17 await fencedframe.execute(async () => { 18 assert_true( 19 document.featurePolicy.allowsFeature('shared-storage'), 20 "Shared storage should be allowed in the fenced frame."); 21 assert_true( 22 document.featurePolicy.allowsFeature('private-aggregation'), 23 "Private aggregation should be allowed in the fenced frame."); 24 assert_false( 25 document.featurePolicy.allowsFeature('attribution-reporting'), 26 "Attribution reporting should be disallowed in the fenced frame."); 27 assert_false( 28 document.featurePolicy.allowsFeature('sync-xhr'), 29 "USB access should be disallowed in the fenced frame."); 30 }, []); 31 }, 'Fenced frames should inherit features from parent if nothing specified.'); 32 33 promise_test(async(t) => { 34 const fencedframe = await attachFencedFrameContext({ 35 origin: get_host_info().REMOTE_ORIGIN, 36 attributes: [["allow", 37 "shared-storage *; attribution-reporting *; " + 38 "private-aggregation 'none'"]]}); 39 40 await fencedframe.execute(async () => { 41 assert_true( 42 document.featurePolicy.allowsFeature('shared-storage'), 43 "Shared storage should be allowed in the fenced frame."); 44 assert_false( 45 document.featurePolicy.allowsFeature('private-aggregation'), 46 "Private aggregation should be disallowed in the fenced frame."); 47 assert_false( 48 document.featurePolicy.allowsFeature('attribution-reporting'), 49 "Attribution reporting should be disallowed in the fenced frame."); 50 assert_false( 51 document.featurePolicy.allowsFeature('sync-xhr'), 52 "USB access should be disallowed in the fenced frame."); 53 }, []); 54 }, 'Fenced frames default feature policies should inherit when using `allow` ' + 55 'but should be able to further restrict the policies.'); 56 57 </script> 58 </body> 59 </html>