compute-pressure.https.html (1222B)
1 <!DOCTYPE html> 2 <title>Verify that Compute Pressure API from a fenced frame is blocked</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 9 <body> 10 <script> 11 promise_test(async () => { 12 const frame = attachFencedFrameContext({ 13 headers: [["Permissions-Policy", "compute-pressure=*"]] 14 }); 15 const result = await frame.execute(async () => { 16 try { 17 const observer = new PressureObserver(() => {}); 18 await observer.observe('cpu'); 19 return 'observation succeeded'; 20 } catch (e) { 21 if (e.name == 'NotAllowedError' && 22 e.message.includes(`Access to the feature "compute pressure" is ` 23 + "disallowed by permissions policy.")) { 24 return 'observation failed'; 25 } else { 26 return `observation failed with unknown error - ${e.name}: ${e.message}`; 27 } 28 } 29 }); 30 assert_equals(result, 'observation failed', 31 'PressureObserver.observe() fails in a fenced frame.'); 32 }, 'PressureObserver.observe() fails in a fenced frame.'); 33 </script> 34 </body>