test_1979050.html (1773B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test bug 1979050</title> 4 <script> 5 Object.prototype.imports = { 6 "./module_simpleExport.mjs": "./scope1/module_simpleExport.mjs", 7 }; 8 Object.prototype.scopes = { 9 "chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/": { 10 "./scope1/module_simpleExport.mjs": "/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs" 11 } 12 }; 13 Object.prototype.integrity = { 14 "./scope1/scope2/module_simpleExport.mjs": "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" 15 }; 16 17 </script> 18 <script type="importmap"> 19 {} 20 </script> 21 22 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 23 24 <script type="module" src="module_1979050.mjs"></script> 25 <script type="module" src="./scope1/module_1979050.mjs"></script> 26 <script type="module" src="./scope1/scope2/module_1979050.mjs"></script> 27 <script> 28 var result, result2, result3; 29 30 SimpleTest.waitForExplicitFinish(); 31 32 // eslint-disable-next-line no-unused-vars 33 function testLoaded() { 34 ok(result == 42, 'Check static imported value result: ' + result); 35 ok(result2 == 84, 'Check static imported value result2: ' + result2); 36 ok(result3 == 126, 'Check static imported value result3: ' + result3); 37 38 import("./module_simpleExport.mjs").then((ns) => { 39 ok(ns.x == 42, 'Check dynamic imported value result: ' + ns.x); 40 return import("./scope1/module_1979050.mjs"); 41 }).then((ns) => { 42 ok(ns.y == 84, 'Check dynamic imported value ns.y: ' + ns.y); 43 return import("./scope1/scope2/module_1979050.mjs"); 44 }).then((ns) => { 45 ok(ns.z == 126, 'Check dynamic imported value ns.z: ' + ns.z); 46 SimpleTest.finish(); 47 }); 48 } 49 </script> 50 <body onload='testLoaded()'></body>