Skip to content

Commit

Permalink
Part 3: wpt with <base> for import-maps.
Browse files Browse the repository at this point in the history
With <base> element changes the base URL to "./resources/", the baseURL
of the import map should be updated as well.
The url "log.js" in the import map will be resolved to "./resources/log.js".

Differential Revision: https://phabricator.services.mozilla.com/D150718

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1773997
gecko-commit: 968815f882d2e5d5775b74f035fc20a0b1931ffe
gecko-reviewers: jonco, yulia
  • Loading branch information
allstarschh authored and moz-wptsync-bot committed Jul 26, 2022
1 parent faec29c commit d6a7d48
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions import-maps/import-maps-base-url.sub.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>

<script>

// baseURL will be used to create a <base> element, which will change the
// baseURL of the import map.
const baseURL = "http://{{host}}:{{ports[http][0]}}/import-maps/resources/";
const importMap = `
{
"imports": {
"bare/bare": "./log.js?pipe=sub&name=bare"
}
}
`;

window.addEventListener("load", () => {
testStaticImport(importMap, baseURL, "bare/bare", "log:bare");
testDynamicImport(importMap, baseURL, "bare/bare", "log:bare", "module");
testDynamicImport(importMap, baseURL, "bare/bare", "log:bare",
"text/javascript");
});

</script>
<body>

0 comments on commit d6a7d48

Please sign in to comment.