resolution-consistency-in-module-tree-inline.html (1125B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 </head> 7 <body> 8 <script> 9 function waitForBool(boolName) { 10 return new Promise((resolve) => { 11 const checkVariable = setInterval(() => { 12 if (window[boolName]) { 13 clearInterval(checkVariable); 14 resolve(); 15 } 16 }, 0); 17 }); 18 } 19 20 step_timeout(() => { 21 const importMapScript = document.createElement('script'); 22 importMapScript.type = 'importmap'; 23 importMapScript.textContent = JSON.stringify({ 24 imports: { 25 "../resources/log.sub.js?name=A": "../resources/log.sub.js?name=B" 26 } 27 }); 28 document.head.appendChild(importMapScript); 29 }, 100); 30 const log = []; 31 </script> 32 <script type="module"> 33 import "../resources/importer.sub.js?pipe=trickle(d0.5)&name=..%2Fresources%2Flog.sub.js%3Fname%3DA"; 34 </script> 35 <script type="module"> 36 test(() => { 37 assert_array_equals(log, ["log:B"], "Import should use the new import map"); 38 }, "Module tree that started to download before a new import map should still take it into account"); 39 </script> 40 </body> 41 </html>