dynamic-import.html (974B)
1 <!DOCTYPE html> 2 <html> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script> 6 const log = []; 7 // To ensure we are testing that the flag is cleared at the beginning of module 8 // script loading unconditionally, not at the end of loading or not at the 9 // first attempt to resolve a module specifier, trickle(d1) is used to ensure 10 // the following import map is added after module loading is triggered but 11 // before the first module script is parsed. 12 promise_test(() => import('../resources/empty.js?pipe=trickle(d1)'), 13 "A dynamic import succeeds"); 14 </script> 15 <script type="importmap"> 16 { 17 "imports": { 18 "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B" 19 } 20 } 21 </script> 22 <script> 23 promise_test(() => { 24 return import("../resources/log.js?pipe=sub&name=A") 25 .then(() => assert_array_equals(log, ["log:B"])) 26 }, 'After a dynamic import(), import maps work fine'); 27 </script>