test_asyncInlineModules.html (896B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test async inline modules</title> 4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 5 <script> 6 var results = []; 7 8 SimpleTest.waitForExplicitFinish(); 9 10 function arrayEquals(a, b) { 11 if (a.length != b.length) { 12 return false; 13 } 14 for (let i = 0; i < a.length; i++) { 15 if (a[i] != b[i]) { 16 return false; 17 } 18 } 19 return true; 20 } 21 22 // eslint-disable-next-line no-unused-vars 23 function testLoaded() { 24 ok(arrayEquals(results.sort(), [1, 2, 3]), 'Check modules imported'); 25 SimpleTest.finish(); 26 } 27 </script> 28 <script type="module" async> 29 /* global results */ 30 results.push(1); 31 </script> 32 <script type="module" async> 33 import "./module_simple2.mjs"; 34 </script> 35 <script type="module" async> 36 /* global results */ 37 results.push(3); 38 </script> 39 <body onload='testLoaded()'></body>