nonce-failure.html (730B)
1 <!DOCTYPE html> 2 <html> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc';"> 6 <script type="importmap"> 7 { 8 "imports": { 9 "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B" 10 } 11 } 12 </script> 13 <script type="importmap" nonce="wrong"> 14 { 15 "imports": { 16 "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B" 17 } 18 } 19 </script> 20 <script nonce="abc"> 21 const log = []; 22 promise_test(() => { 23 return import("../resources/log.js?pipe=sub&name=A") 24 .then(() => assert_array_equals(log, ["log:A"])) 25 }, 26 'Importmap should be rejected due to nonce'); 27 </script>