gecko-dev/testing/web-platform/tests/import-maps/builtin-empty.tentative.html
Hiroshige Hayashizaki 2d71b0e154 Bug 1528229 [wpt PR 15371] - [Import Maps] Implement Import Maps v0.5 behind a flag, a=testonly
Automatic update from web-platform-tests
[Import Maps] Implement Import Maps v0.5 behind a flag

Design doc: https://docs.google.com/document/d/1vFQzbmxg9ilpg8CT_P8roEYcpTfZ06Q5N4J9-ZQqqZo/edit

This CL implements an initial version of Import Maps that supports
- Inline import maps (i.e. no src attribute),
- Layered API/Built-in modules fallback, and
- Basic bare specifier mapping.

The import maps are behind the flag of LayeredAPI.

Bug: 848607
Change-Id: I31efa6f9ce470375a07592f627b525f48dc2d504
Reviewed-on: https://chromium-review.googlesource.com/c/1449093
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631880}

--

wpt-commits: 7ddae5400caf476583cfbe71238254f8cbb217b9
wpt-pr: 15371
2019-03-16 12:12:38 +00:00

43 lines
1.3 KiB
HTML

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script>
const importMap = `
{
"imports": {
"./resources/log.js?pipe=sub&name=empty": [ "@std/" ],
"./resources/log.js?pipe=sub&name=empty-fallback": [
"@std/",
"./resources/log.js?pipe=sub&name=empty-fallback"
]
}
}
`;
const tests = {
// Arrays of expected results for:
// - <script src type="module">,
// - <script src> (classic script),
// - static import, and
// - dynamic import.
// Discussions about notations are ongoing, e.g.
// https://github.com/tc39/proposal-javascript-standard-library/issues/12
// Currently the tests expects two notations are accepted.
// TODO: Once the discussions converge, update this and related tests.
"std:":
[Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR],
"@std/":
[Result.FETCH_ERROR, Result.PARSE_ERROR, Result.FETCH_ERROR, Result.FETCH_ERROR],
"./resources/log.js?pipe=sub&name=empty":
[Result.URL, Result.URL, Result.PARSE_ERROR, Result.PARSE_ERROR],
"./resources/log.js?pipe=sub&name=empty-fallback":
[Result.URL, Result.URL, Result.URL, Result.URL],
};
doTests(importMap, null, tests);
</script>
<body>