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