integrity.html (827B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 </head> 7 <body> 8 <script> 9 const log = []; 10 </script> 11 <script type="importmap"> 12 { 13 "imports": { 14 "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B" 15 }, 16 "integrity": { 17 "../resources/log.js?pipe=sub&name=B": "sha384-PeZ0Scqs60QjpuvHAyomddrpcCuox9hUwAff1yx1Lv2HtPIAfsSuHi6VKGK3nH3w" 18 } 19 } 20 </script> 21 <script type="importmap"> 22 { 23 "integrity": { 24 "../resources/log.js?pipe=sub&name=B": "sha384-foobar" 25 } 26 } 27 </script> 28 <script type="module"> 29 import '../resources/log.js?pipe=sub&name=A'; 30 </script> 31 <script type="module"> 32 test(t => { 33 assert_array_equals(log, ["log:B"]); 34 }, 'Static script loaded as its integrity check passed'); 35 </script> 36 </body> 37 </html>