no-referencing-script-integrity.html (1177B)
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=NoReferencingScriptInvalidCheck": "sha384-Li9vy3DqF8tnTXuiaAJuML3ky+er10rcgNR/VqsVpcw+ThHmYcwiB1pbOxEbzJr7" 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" 32 onload="import('./resources/log.js?pipe=sub&name=NoReferencingScriptInvalidCheck').then(promiseResolve).catch(promiseReject)"> 33 <script type="module"> 34 promise_test(async t => { 35 await promise_rejects_js(t, TypeError, promise); 36 }, "Script was not loaded as its integrity check failed"); 37 </script> 38 </body> 39 </html>