no-referencing-script-integrity-valid.html (1225B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 let log = []; 8 </script> 9 <script type="importmap"> 10 { 11 "integrity": { 12 "./resources/log.js?pipe=sub&name=NoReferencingScriptValidCheck": "sha384-5eRmXQSBE6H5ENdymdZxcyiIfJL1dxtH8p+hOelZY7Jzk+gt0gYyemrGY0cEaThF" 13 } 14 } 15 </script> 16 <script> 17 let promiseResolve; 18 let promiseReject; 19 let promise = new Promise((resolve, reject) => { 20 promiseResolve = resolve; 21 promiseReject = reject; 22 }); 23 </script> 24 </head> 25 <body> 26 <!-- This is testing the part of 27 https://html.spec.whatwg.org/multipage/webappapis.html#hostloadimportedmodule 28 where step 6's condition is false and referencingScript remains null. 29 Therefore, the onload event must be defined as an HTML attribute, outside of any script tag. 30 --> 31 <img src="/images/green.png?2" 32 onload="import('./resources/log.js?pipe=sub&name=NoReferencingScriptValidCheck').then(promiseResolve).catch(promiseReject)"> 33 <script> 34 promise_test(async () => { 35 await promise; 36 assert_equals(log.length, 1); 37 assert_equals(log[0], "log:NoReferencingScriptValidCheck"); 38 }, "Script was loaded as its valid integrity check passed"); 39 </script> 40 </body> 41 </html>