modulepreload-sri.html (737B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="modulepreload" href="resources/module1.js" integrity="sha384-invalid"> 6 <script type="module" src="resources/module1.js" id="myscript"></script> 7 <body> 8 <script> 9 // compared to modulepreload.html, this tests behavior when elements are 10 // initially on an HTML page instead of being added by JS 11 promise_test(() => { 12 return new Promise((resolve, reject) => { 13 let myscript = document.querySelector('#myscript'); 14 myscript.onerror = resolve; 15 myscript.onload = reject; 16 }); 17 }, "Script should not be loaded if modulepreload's integrity is invalid"); 18 </script>