http-url-like-specifiers.sub.html (1653B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="resources/test-helper.js"></script> 5 6 <script> 7 // "bare/..." (i.e. without leading "./") are bare specifiers 8 // (not relative paths). 9 const importMap = ` 10 { 11 "imports": { 12 "bare": "./resources/log.js?pipe=sub&name=bare", 13 14 "./resources/log.js?pipe=sub&name=foo": "./resources/log.js?pipe=sub&name=bar", 15 "./resources/log.js?pipe=sub&name=cross-origin-foo": "https://{{domains[www1]}}:{{ports[https][0]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-bar", 16 "./resources/log.js?pipe=sub&name=to-data": "data:text/javascript,log.push('dataURL')", 17 18 "./resources/log.js?pipe=sub&name=to-bare": "bare" 19 } 20 } 21 `; 22 23 const tests = { 24 // Arrays of expected results for: 25 // - <script src type="module">, 26 // - <script src> (classic script), 27 // - static import, and 28 // - dynamic import. 29 30 // HTTP(S) to HTTP(S). 31 "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=foo": 32 [Result.URL, Result.URL, "log:bar", "log:bar"], 33 "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=cross-origin-foo": 34 [Result.URL, Result.URL, "log:cross-origin-bar", "log:cross-origin-bar"], 35 36 // HTTP(S) to data: 37 "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-data": 38 [Result.URL, Result.URL, "dataURL", "dataURL"], 39 40 // HTTP(S) to bare mapping is disabled. 41 "{{location[server]}}/import-maps/resources/log.js?pipe=sub&name=to-bare": 42 [Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR], 43 }; 44 45 doTests(importMap, null, tests); 46 </script> 47 <body>